Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx: [emerg] a duplicate default server

When I try restart nginx and write in console this command

nginx -t

I have an error:

nginx: [emerg] a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default.save:20
nginx: configuration file /etc/nginx/nginx.conf test failed

sites-enabled/default

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        server_name localhost;
        passenger_enabled on;
        rails_env    production;
        root         /home/hh/public;

        access_log  /var/log/nginx/host.access.log;
        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
}

nginx.conf

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
        worker_connections 768;
}

http {

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;


        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

One hour ago everything worked fine, but after restart nginx I have this issue.

like image 224
Croaton Avatar asked Apr 14 '15 05:04

Croaton


1 Answers

If you look at /etc/nginx/sites-enabled/ you see two files, default.save and default just remove one of them

 sudo rm -rf  /etc/nginx/sites-enabled/default.save 
like image 97
Yuseferi Avatar answered Oct 22 '22 10:10

Yuseferi