at moment running website in nginx/1.6.3 on centos7
everything runs smooth, except redirects.
this .conf file looks like:
server { listen 443 ssl spdy default deferred; server_name .example.com; ... more configs } server { listen 80; server_name .example.com; return 301 https://example.com$request_uri; } what accomplish following scenarios:
user visits in browser | should happen ------------------------------------|------------------------------------- https://example.com$request_uri | deliver content https://*.example.com$request_uri | 301 https://example.com$request_uri https://123.123.123.123$request_uri | 301 https://example.com$request_uri http://example.com$request_uri | 301 https://example.com$request_uri http://*.example.com$request_uri | 301 https://example.com$request_uri http://123.123.123.123$request_uri | 301 https://example.com$request_uri
please check running following config, should work.
#this serve content. server { listen 443 ssl spdy default deferred; server_name example.com; ... more configs } #https calls except example.com redirected here server { listen 443 ssl spdy default deferred; #(can use : "listen 443;") server_name *.example.com 123.123.123.123; return 301 https://example.com$request_uri; } #all port 80 redirection https://example.com server { listen 80; server_name example.com *.example.com 123.123.123.123; return 301 https://example.com$request_uri; }
Comments
Post a Comment