技术解析
/usr/local/nginx/conf/nginx.conf
: ( Nginx Default 的配置文件)
server {
listen 80;
listen [::]:80 ipv6only=on;
server_name _;
}
...
include vhost/*.conf;
}
/usr/local/nginx/conf/vhost/xxx.conf
:
server {
...
listen 443 ssl http2 fastopen=3 reuseport;
listen [::]:443 ssl http2 fastopen=3 reuseport ipv6only=on;
...
}
...
server {
listen 80;
listen [::]:80 ipv6only=on;
server_name xxxx.com;
location / {
rewrite 美国服务器 ^/(.*)$ https://xxx.com/$1 permanent;
}
}
service nginx reload
提示错误: nginx: [emerg] duplicate listen options for [::]:80 in /usr/local/nginx/conf/vhost/xxx.conf:97
请问我的配置错在哪里呢?我想在 IPv6 访问的时候也能重定向到 https 页面。