Reputation: 15076
I start jwilder nginx proxy on 8080
docker run -d -p 8080:80 -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy
I'm running a standard php:apache
container without mapping the port (so 80 is exposed on the container network).
I use an env var to connect with the proxy:
docker run -d -e VIRTUAL_HOST=test.example.com php:apache
on my localhost I've added this in /etc/hosts:
IP test.example.com
Now I visit text.example.com:8080
on my computer so I try to connect with the reverse proxy (8080) which will route me to php-apache on container port 80.
But I get this error:
Error:
Forbidden
You don't have permission to access / on this server.
Apache/2.4.10 (Debian) Server at test.example.com Port 8080
What am I missing? Do I have the change the apache configuration somewhere? (it's now all default). It seems to go throught the nginx because I'm seeing an apache error so I think I need to tell the apache inside (php apache): Allow this 'route')?
Upvotes: 0
Views: 756
Reputation: 263637
Your title appears to be misleading. From your description, you've setup a properly functioning reverse proxy and the target you are connecting to with your reverse proxy is broken. If you review the docker hub page on the php:apache image you'll find multiple examples for how to load your php code into the image and get it working. E.g.:
$ docker run -d -e VIRTUAL_HOST=test.example.com \
-v "$PWD/your/php/code/dir":/var/www/html php:7.0-apache
Upvotes: 1