LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   nginx duplicate listen error (https://www.linuxquestions.org/questions/linux-newbie-8/nginx-duplicate-listen-error-4175503614/)

tt1187 05-01-2014 02:37 PM

nginx duplicate listen error
 
Hello,

I'm trying to learn how to add vhosts to nginx following this guide - https://digitalocean.com/community/a...ks-on-centos-6

I got up to step four until this happened;

Code:

service nginx restart
nginx: [emerg] a duplicate listen 0.0.0.0:80 in /usr/local/nginx/conf/nginx.conf:86
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

And here's my config file with my edit;

Code:

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include      mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush    on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen      80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root  html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

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

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass  http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root          html;
        #    fastcgi_pass  127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration

    server {
        listen      80;
        listen      *:80;
        server_name  nginx.chickenkiller.com;

        location / {
            root  /var/www/nginx.chickenkiller.com/public_html/;
            index  index.html index.htm;
        }
    }


    # HTTPS server
    #
    #server {
    #    listen      443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root  html;
    #        index  index.html index.htm;
    #    }
    #}

}

Anyone have any suggestions on how I can go about to fix the problem.

Thank you.

szboardstretcher 05-01-2014 02:48 PM

Change this:

Code:

listen      80;
 listen      *:80;


to this:

Code:

listen      *:80;


All times are GMT -5. The time now is 06:31 PM.