用Docker部署Nginx,配置中的server_name localhost冲突导致无法匹配
问题描述:使用Docker部署Nginx后,发现配置中的localhost无法匹配。
docker-compose.yml中的Nginx配置:
Nginx中的Server配置:
查看Nginx日志发现警告提示:
问题原因:nginx.conf配置中引入了其他配置文件,导致server_name localhost的配置冲突,其他配置中的server优先匹配,所以新的配置无效。
问题描述:使用Docker部署Nginx后,发现配置中的localhost无法匹配。
docker-compose.yml中的Nginx配置:
Nginx中的Server配置:
查看Nginx日志发现警告提示:
问题原因:nginx.conf配置中引入了其他配置文件,导致server_name localhost的配置冲突,其他配置中的server优先匹配,所以新的配置无效。