Default Nginx page served to client


#1

I really can’t figure this one out and I can’t recreate the issue, I’m wondering if it could have something to do with the new redis caching. But someone trying to access my website just typing in ryansmithphotography.com without the https:// got the default nginx setup page. All test that I do show that it should redirect properly to https://www.ryansmithphotography.com, and once the user typed in the https it worked fine. Does anyone have an idea what might cause this issue even though as far as I can tell everything works perfectly. Here is my nginx config.

server {

    listen 443 ssl spdy;
    server_name ryansmithphotography.com   www.ryansmithphotography.com;
    ssl on;
    ssl_certificate /var/www/ryansmithphotography.com/cert/ryansmithphotography.com.crt;
    ssl_certificate_key /var/www/ryansmithphotography.com/cert/ryansmithphotography.com.key;
    add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
    access_log /var/log/nginx/ryansmithphotography.com.access.log rt_cache_redis;
    error_log /var/log/nginx/ryansmithphotography.com.error.log;


    root /var/www/ryansmithphotography.com/htdocs;



    index index.php index.html index.htm;
    subs_filter https://www.ryansmithphotography.com/wp-content/uploads https://cdn.ryansmithphotography.com/$

    include  common/redis.conf;

    include common/wpcommon.conf;
    include common/locations.conf;
    include /var/www/ryansmithphotography.com/conf/nginx/*.conf;
}
server {
    listen 80;
    server_name ryansmithphotography.com;
    return 301 https://www.ryansmithphotography.com$request_uri;
}

#2

Hi @rsmith4321

I too have come across this issue , I am not sure whats causing this glitch. You may use the following nginx config. ,I have tested it and its free from the reported glitch .

server {

listen 80;
server_name ryansmithphotography.com;
return 301 https://ryansmithphotography.com$request_uri; 

}

server {

listen 80;
server_name www.ryansmithphotography.com;
return 301 https://ryansmithphotography.com$request_uri; 

}

server {

listen 443 ssl spdy;
server_name ryansmithphotography.com ;
ssl on;
ssl_certificate /var/www/ryansmithphotography.com/cert/ryansmithphotography.com.crt;
ssl_certificate_key /var/www/ryansmithphotography.com/cert/ryansmithphotography.com.key;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
access_log /var/log/nginx/ryansmithphotography.com.access.log rt_cache_redis;
error_log /var/log/nginx/ryansmithphotography.com.error.log;


root /var/www/ryansmithphotography.com/htdocs;



index index.php index.html index.htm;
subs_filter https://www.ryansmithphotography.com/wp-content/uploads https://cdn.ryansmithphotography.com/$

include  common/redis.conf;

include common/wpcommon.conf;
include common/locations.conf;
include /var/www/ryansmithphotography.com/conf/nginx/*.conf; }

#3

Hi @rsmith4321

Is your live-site https://www.ryansmithphotography.com/ running on exactly the same nginx configuration that you posted here ?

Thanks,


#4

Yes it is, except I actually changed my code to include ryansmithphotography.com and www.ryansmithphotography.com to listen on port 80 already, I thought maybe that would help, I’ll try the way you suggested.

Also, the only way I could imagine someone would see the default nginx page is if they were hitting my server on the bare ip address without a domain name, or if the system wasn’t sending them to the correct virtual hosts. So in my default /html/ directory that was created I added an index.html file that would forward to https://www.ryansmithphotography.com just incase someone hit that somehow. Hopefully that is enough.


#5

I notice in the config you gave me under listen 443 you just have the server_name ryansmithphotography.com. Should it not be like I had it to listen on ryansmithphotography.com and on www.ryansmithphotography.com, or does it not matter?


#6