nginx deployment

Hi, I have deployed my rails application using nginx module. It is running successfully but my problem is whenever I am restart/start the server I am getting following warning "[warn]: conflicting server name "localhost" on 0.0.0.0:3000, ignored"

My nginx.conf file is as follows:-

#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 {     passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15;     passenger_ruby /usr/local/bin/ruby;

    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 3000;        server_name localhost;        root /home/rails_project/find_my_home_demo/public; # <--- be sure to point to 'public'!        passenger_enabled on;        passenger_use_global_queue on;      }

    server {         listen 3000;         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

Hi,

You have 2 servers to listen on the port 3000 in the config, thats the problem imo

Hi,

As you can see, the second server to listen on 3000 has been given the server_name localhost. Nginx is ignoring that config since it can’t listen on the same port twice.