Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an existing website up on a Nginx/Ubuntu (ve) server. Lets call it domain1.com

I am trying to add a 2nd website to the Nginx server.

There are Nginx configuration files located in:

  • nginx.conf in /var/
  • conf in server root
  • nginx.conf in /opt/nginx/conf

Does anyone know if one of these supersedes the other?

I have edited all the files so that they are the same since I didnt know which to edit. After editing, it looks like the changes only took effect with the config file in /opt/nginx/conf/

The problem is domain2.com is not working. If I visit the URL, it is not being hosted correctly. Sorry I mean the page is not displaying -- index.html does not show. I see the godaddy parked page. Yes, the nameservers are set correctly. I presumed the error was with my Nginx config

Here is the conf file:

#user  nobody;
worker_processes  4;
error_log  logs/error.log;
#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    passenger_root /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/passenger-2.2.15;
    passenger_ruby /opt/ruby-enterprise-1.8.7-2010.02/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  /opt/nginx/logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip  on;
    gzip_http_version 1.1;
    gzip_vary on;
    gzip_comp_level 6;
    gzip_proxied any;
    gzip_types text/plain application/pdf video/mp4 video/quicktime text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_buffers 16 8k;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    server {
        listen      80;
        server_name     www.domain1.com domain1.com;

        rewrite ^(.*)   https://domain1.com$1 permanent;

    }

#*********** ssl server setup ***********
   server {
        client_max_body_size 500M;
        client_body_buffer_size 256k;
            listen   443;
            server_name www.domain1.com domain1.com;

        access_log /var/www/domain1.com/shared/log/access.log;
            error_log /var/www/domain1.com/shared/log/error.log;

        ssl                  on;
            ssl_certificate      /var/shared/public.crt;
            ssl_certificate_key  /var/shared/domain1.key;
            #ssl_session_timeout  5m;
        #ssl_protocols  SSLv2 SSLv3 TLSv1;
           #ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
           #ssl_prefer_server_ciphers   on;

           root   /var/www/domain1.com/current/public;
           passenger_enabled on;

    }

    server {
        listen      80;
        server_name     www.domain2.com domain2.com;
        rewrite ^/(.*)  https://domain2.com/$1 permanent;
     }


    server {
        client_max_body_size 500M;
        client_body_buffer_size 256k;
            listen   443;
            server_name www.domain2.com domain2.com;

            #ssl                  on;
            #ssl_certificate      /var/shared/domain2.cer;
            #ssl_certificate_key  /var/shared/server.key;

            #ssl_session_timeout  5m;


            access_log /var/www/domain2.com/shared/log/access.log;
            error_log /var/www/domain2.com/shared/log/error.log;

            root   /var/www/domain2.com/public;

            passenger_enabled on;

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


}

Domain1 works well.

Any ideas on domain 2?

edit: I have restarted the Nginx server, no luck.

Thanks

share|improve this question
    
What exactly is the problem that you are having? "it is not being hosted correctly" tells us nothing. –  Michael Hampton Sep 17 '12 at 19:13
    
Sorry I mean the page is not displaying-- index.html does not show as expected –  user1017058 Sep 17 '12 at 19:15
    
So what DOES happen? –  Michael Hampton Sep 17 '12 at 19:16
    
Nothing? I see the godaddy parked page. Yes, the nameservers are set correctly. I presumed the error was with my Nginx config. –  user1017058 Sep 17 '12 at 19:17
    
Have you checked your DNS setup, and waited for any changes to propagate? –  Michael Hampton Sep 17 '12 at 19:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.