Question

Hey, my website was working after adding cert bot it was also working then I restarted the server and I got this error I cant fix it

Posted December 28, 2021 215 views
NginxUbuntuDigitalOcean Droplets
nginx: [warn] conflicting server name "_" on 0.0.0.0:80, ignored  
nginx: [warn] conflicting server name "_" on [::]:80, ignored     
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok  
nginx: configuration file /etc/nginx/nginx.conf test is successful

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there,

The output that you’ve shared contains only warnings that should not prevent Nginx from running. If you check the status of the service is it reported as running:

sudo systemctl status nginx

Also do you see any errors in the Nginx error log:

tail -100 /var/log/nginx/error.log

Best,
Bobby

  • ● nginx.service - A high performance web server and a reverse proxy server
         Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
         Active: active (running) since Tue 2021-12-28 22:05:19 UTC; 1min 27s ago
           Docs: man:nginx(8)
        Process: 3588 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
        Process: 3600 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
       Main PID: 3601 (nginx)
          Tasks: 2 (limit: 1136)
         Memory: 2.9M
         CGroup: /system.slice/nginx.service
                 ├─3601 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
                 └─3602 nginx: worker process
    
    Dec 28 22:05:19 ubuntu-s-1vcpu-1gb-intel-sfo3-01 systemd[1]: nginx.service: Succeeded.
    Dec 28 22:05:19 ubuntu-s-1vcpu-1gb-intel-sfo3-01 systemd[1]: Stopped A high performance web server and a reverse proxy server.
    Dec 28 22:05:19 ubuntu-s-1vcpu-1gb-intel-sfo3-01 systemd[1]: Starting A high performance web server and a reverse proxy server...
    Dec 28 22:05:19 ubuntu-s-1vcpu-1gb-intel-sfo3-01 nginx[3588]: nginx: [warn] conflicting server name "_" on 0.0.0.0:80, ignored
    Dec 28 22:05:19 ubuntu-s-1vcpu-1gb-intel-sfo3-01 nginx[3588]: nginx: [warn] conflicting server name "_" on [::]:80, ignored
    Dec 28 22:05:19 ubuntu-s-1vcpu-1gb-intel-sfo3-01 nginx[3600]: nginx: [warn] conflicting server name "_" on 0.0.0.0:80, ignored
    Dec 28 22:05:19 ubuntu-s-1vcpu-1gb-intel-sfo3-01 nginx[3600]: nginx: [warn] conflicting server name "_" on [::]:80, ignored
    Dec 28 22:05:19 ubuntu-s-1vcpu-1gb-intel-sfo3-01 systemd[1]: Started A high performance web server and a reverse proxy server.
    

    Here is my site which is getting 404

  • 2021/12/28 21:47:50 [error] 3348#3348: *7 directory index of "/var/www/haider-ali.xyz/" is forbidden, client: 92.99.168.223, server: haider-ali.xyz, request: "GET / HTTP/1.1", host: "haider-ali.xyz"
    2021/12/28 21:47:51 [error] 3348#3348: *7 directory index of "/var/www/haider-ali.xyz/" is forbidden, client: 92.99.168.223, server: haider-ali.xyz, request: "GET / HTTP/1.1", host: "haider-ali.xyz"
    2021/12/28 21:47:52 [error] 3348#3348: *7 directory index of "/var/www/haider-ali.xyz/" is forbidden, client: 92.99.168.223, server: haider-ali.xyz, request: "GET / HTTP/1.1", host: "haider-ali.
    
    • Hi there,

      It looks like that the Nginx service is running as expected but from the error log it seems like that there is either no content in the /var/www/haider-ali.xyz/ directory or your website files might be stored in another directory.

      You could check that with the ls command:

      ls -lah /var/www/haider-ali.xyz/
      

      If you don’t see any files in there I could suggest two things:

      • Make sure that the root definition is set to the correct directory in your Nginx server block
      • If you have multiple Nginx server blocks in the /etc/nginx/sites-enabled directory, make sure to disable the ones that are not needed like the default one for example. You can do that with the unlink command.

      Let me know how it goes.
      Best,
      Bobby