Я пытаюсь запустить образ докера с localhost.Код с открытым исходным кодом и здесь:
https://github.com/Helium-MVC/Boilerplate
Когда я запускаю docker-compose up
, я получаю следующее:
helium_nginx | 2018/12/11 07:43:31 [warn] 1#1: conflicting server name "localhost" on 0.0.0.0:80, ignored
helium_nginx | nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
Теперь мой докер site.confИмеется только 1 vhost:
server {
#The port to listen on. SSL would listen on 443
listen 80 default_server;
#The name/alias the server listens for when deciding to use this configuration
server_name localhost _;
#Where the lo files are being written too
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
#Location of our site
location / {
#The root of the site is in public_html
root /code/site/public_html/;
index index.php index.html index.htm;
#important for pretty url and routing
try_files $uri $uri/ /index.php?rt=$uri&$args;
}
}
С установленным в yml следующим образом:
web:
image: nginx:latest
container_name: "helium_nginx"
ports:
- "8000:80"
volumes:
- ./:/code
- ./site.conf:/etc/nginx/conf.d/site.conf
- ./nginx_custom_settings.conf:/etc/nginx/conf.d/nginx_custom_settings.conf
links: ['php']
Что странно, если я заменю server_name
на что-то вроде www.example.com и поместите это имя в мой /etc/hosts
файл, , он работает !В противном случае, используя localhost, я получаю только страницу nginx по умолчанию .Что может быть не так?