Bouncing to Default Server Block

Bee.Lists bee.lists at gmail.com
Fri Sep 28 12:43:23 UTC 2018


I have a test server up with 3 domains.  

First domain redirects port 80 to ssl 443.  
Second domain is just port 80.
Third domain is just port 80.  

Second domain isn’t showing up, pointing to first domain.  Third domain is working.  Why would this happen?

nginx.conf:

# user                          nginx;
worker_processes        auto;

error_log  /var/log/nginx/error.log;
pid        /run/nginx.pid;
events {     worker_connections  1024;        }

http {
    include			/etc/nginx/mime.types;
    keepalive_timeout		65s;
    gzip		on;
    index		index.html;

    passenger_app_env                       development;
    passenger_friendly_error_pages          on;
    include /etc/nginx/conf.d/*.conf;

    server {
       	listen                                  80;
        server_name                             domain1.ca www.domain1.ca;
        return 301                              https://$server_name$request_uri;
    }

    server {
        listen					443 default_server;
        server_name                             domain1.ca www.domain1.ca;
        access_log                              /var/log/nginx/access_domain1.log;
        error_log                               /var/log/nginx/error_domain1.log  warn;
        error_page  404                         /404.html;
        client_max_body_size                    3M;              
        root                                    /var/www/domain1/public;
        passenger_enabled                       on;
        passenger_base_uri                      /;

        location / {
                autoindex                       off;
        }
    location = /img/favicon.ico { access_log off;}

        ssl                                     on;
        ssl_certificate                         /etc/nginx/ssl/domain1_ca.crt;         
        ssl_certificate_key                     /etc/nginx/ssl/domain1.key;           
        ssl_protocols                           TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers	ALL:!aNULL:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    }

    server {
            listen                              80;
            server_name                         domain2 www.domain2;
            access_log                          /var/log/nginx/access_vp.log;
            error_log                           /var/log/nginx/error_vp.log  debug;
            error_page  404                     /404.html;
            root                                /var/www/domain2/public;
            passenger_enabled                   on;
            passenger_base_uri                  /;

            location / {
                autoindex                       off;
#                index                           /;
            }
            location = /favicon.ico { access_log off; log_not_found off; }
            location = /robots.txt { access_log off; log_not_found off; }
            sendfile                            off;
        }

   server {
            listen                              80;
            server_name                         domain3.com www.domain3.com;
            access_log                          /var/log/nginx/access_domain3.log;
            error_log                           /var/log/nginx/error_domain3.log error;
            error_page 404                      /404.html;
            root                                /var/www/domain3/public;
            passenger_enabled                   on;
            passenger_base_uri                  /;

            location / {
                autoindex                       off;
                index                           /;
                }

            location = /img/favicon.ico { access_log off; log_not_found off; }
            location = /robots.txt { access_log off; log_not_found off; }
            sendfile                            off;
        }
}








Cheers, Bee






More information about the nginx mailing list