DEV Community

Discussion on: Docker configuration with Nginx routing for Vue and Laravel

Collapse
 
m0s4ysh3ll0 profile image
Moritz Büttner • Edited

Hello Philip! First of all: Thank you for this good article! It was exactly what I was looking for! :)
I was wondering if it is somehow possible to configure nginx to also allow api requests from outside the container network. When I 'docker exec' into the webserver container, I can call my laravel api with backend:9000/api/test, but from outside the container (eg. with Postman) I get 502 error back from nginx. I was hoping to do it like localhost/api/test, but no success so far.

I'm looking forward to your answer and thanks in advance!

Kind regards,
Mo

Collapse
 
programmingdecoded profile image
Philip Perry

Hi Mo, Sorry for the late answer. Yes, localhost/api/test should work. Is there anything in the Docker logs of your container that could give you a clue as to what went wrong?

Collapse
 
m0s4ysh3ll0 profile image
Moritz Büttner

I figured it out, just forgot to write it here in the comments... :) thank you!