nginx: [warn] conflicting server name "example.com" on 0.0.0.0:80, ignored

11,118

Not sure,but try changing server name in

/etc/nginx/sites-enabled/default

it should help

Share:
11,118
gjivanya
Author by

gjivanya

Updated on June 04, 2022

Comments

  • gjivanya
    gjivanya almost 2 years

    When I'm trying to restart nginx, I'm getting the following error

    nginx: [warn] conflicting server name "example.io" on 0.0.0.0:80, ignored
    

    I used my deploy scripts, to do deploying for 2 domains. For first it works fine, but for second, it gives error.

    Here is my nginx.conf file

    #
    worker_processes 2;
    
    #
    user nginx nginx;
    
    #
    pid /opt/nginx/pids/nginx.pid;
    error_log /opt/nginx/logs/error.log;
    
    #
    events {
        worker_connections  4096;
    }
    
    #
    http {
        #
        log_format full_log '$remote_addr - $remote_user $request_time $upstream_response_time '
                            '[$time_local] "$request" $status $body_bytes_sent $request_body "$http_referer" '
                            '"$http_user_agent" "$http_x_forwarded_for"';
    
        #
        access_log  /opt/nginx/logs/access.log;
    
        ssl on;
        ssl_certificate /opt/nginx/cert/example.crt;
        ssl_certificate_key /opt/nginx/cert/example.key;
    
        #
        include /opt/nginx/conf/vhosts/*.conf;
    
        # Deny access to any other host
        server {
            server_name example.io;  #default
            return 444;
        }
    }
    
  • Carnaru Valentin
    Carnaru Valentin over 3 years
    Yes, works for me! I've try some other way to configure and I forgot to delete default. Thanks!