This is my docker-compose.yml
version: '2'
services:
nginx:
image: nginx:1.11.8-alpine
ports:
- "8081:80"
volumes:
- ./code:/usr/share/nginx/html
- ./html:/myapp
- ./site.conf:/etc/nginx/conf.d/site.conf
- ./error.log:/var/log/nginx/error.log
- ./nginx.conf:/etc/nginx/nginx.conf
And this is site.conf
server {
listen 8081;
index index.html index.php;
server_name localhost;
error_log /var/log/nginx/error.log;
location /html {
root /myapp;
}
}
It works on http://nginx-php-docker.local:8081/
, showing the file index.html
which is inside the /code
folder.
But It is not working with http://nginx-php-docker.local:8081/html
The error log is
2017/01/13 08:50:27 [error] 7#7:
*4 open() "/usr/share/nginx/html/html" failed (2: No such file or directory),
client: 172.19.0.1,
server: localhost,
request: "GET /html HTTP/1.1",
host: "nginx-php-docker.local:8081"