8

I have 2 files. The default:

/etc/nginx/sites-enabled/default

server {

        listen   80; ## listen for ipv4
        listen   [::]:80 default ipv6only=on; ## listen for ipv6 << LINE 10

I then have a custom file:

/etc/nginx/nginx.conf

http {
    server {
        server_name mydomain;
        listen 3000;
        root /projects/myproject/public;
    }
}

When I try to restart the service I receive this error:

the duplicate default server in /etc/nginx/sites-enabled/default:10
configuration file /etc/nginx/nginx.conf test failed

I have minimal experience with nginx and was hoping somebody could point out where I might have gone wrong?

1
  • 3
    grep -lr default /etc/nginx?
    – quanta
    Sep 11, 2012 at 3:30

2 Answers 2

10

8 months late, but anyway...

I had the same problem - it turned out that my editor left a default~ backup file behind after I had edited default. Nginx read both the backup and the edited version and of course found a discrepancy between the two. Simply deleting the backup allowed Nginx to start.

1

In my case I updated both GitLab and the Ubuntu server to 14.04. That apparently made nginx to get a new default config file. Just deleted it keeping the gitlab config made it happy again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .