When I run the command to test my configuration I get an error saying there are multiple duplicates for [::]:80
. Before that I had an issue with duplicate multiple default servers.
When I had the issue with multiple default servers, my file looked like this
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;
}
}
To resolve that problem, I changed the configuration to:
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;
}
}
After the change I started getting a "duplicate options for [::]:80" error. I am not sure what I am doing wrong with this. This is my first time working with Nginx. Any ideas what the issue could be?
nginx -t
output). What nginx version are you running?ipv6only=on
might not be needed anymore. I have this in my server block:listen 80;listen [::]:80;
and it runs fine. Do you have any other server blocks?