大佬教程收集整理的这篇文章主要介绍了ubuntu – Nginx重复[::]:80错误的监听选项,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
当我遇到多个默认服务器的问题时,我的文件看起来像这样
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/Nginx/html; index index.php index.html index.htm; server_name munki; error_page 404 /404.html; error_page 500 502 503 504 /50x.html; LOCATIOn = /50x.html { root /usr/share/Nginx/html; } LOCATIOn /report { try_files $uri $uri/ =404; } LOCATIOn ~ \.php${ try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } LOCATIOn /munki_repo/ { alias /usr/local/munki_repo/; autoindex off; auth_basic "ReStricted"; auth_basic_user_file /etc/Nginx/.htpasswd; } }
要解决该问题,我将配置更改为:
server { listen 80; listen [::]:80 ipv6only=on; root /usr/share/Nginx/html; index index.php index.html index.htm; server_name munki; error_page 404 /404.html; error_page 500 502 503 504 /50x.html; LOCATIOn = /50x.html { root /usr/share/Nginx/html; } LOCATIOn /report { try_files $uri $uri/ =404; } LOCATIOn ~ \.php${ try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } LOCATIOn /munki_repo/ { alias /usr/local/munki_repo/; autoindex off; auth_basic "ReStricted"; auth_basic_user_file /etc/Nginx/.htpasswd; } }
更改后,我开始收到“[::]:80”重复选项错误.我不确定我做错了什么.这是我第一次使用Nginx.任何想法可能是什么问题?
请发布错误消息(Nginx -t输出),因为它可能包含一些有用的见解.
你在运行什么Nginx版本?可能不再需要选项ipv6only = on,相反可能会产生问题.我在我的服务器块中有这个并且运行正常:
listen 80; listen [::]:80;
您是否有任何其他未发布的服务器块可能会相互冲突?
说明:让我们读一下当前(1.13)Nginx documentation:
默认情况下,此参数处于启用状态,表示不应使用ipv6only = on.它没有任何好处,可能会产生问题(见下一点).
它只能设置一次就意味着如果你在配置中的任何地方不止一次(例如在不同的服务器块中),它将抛出一个错误:Nginx:[emerg]重复[::]的监听选项:80.
以上是大佬教程为你收集整理的ubuntu – Nginx重复[::]:80错误的监听选项全部内容,希望文章能够帮你解决ubuntu – Nginx重复[::]:80错误的监听选项所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。