我刚刚configurationnginxredirecthttp到https就像在如何强制或redirect到nginx中的SSL所述? 通过使用:
server { listen 80; server_name rsm.website www.rsm.website; return 301 https://www.rsm.website$request_uri; }
而redirect似乎是一半的工作,因为我redirect到https,但似乎松散$request_uripath。 所以,如果用户去rsm.website/foo/faa它总是被redirect到https://rsm.website
我怎样才能使$ request_urivariables工作?
编辑:
似乎redirectwww.rsm.website/foo作品。 它只有在没有www.时候才会失败www. 在rsm.website之前
这是另一个服务器块。 (我只有两个)
server { listen 443 ssl; server_name www.rsm.website; ssl_certificate /etc/nginx/ssl/certificate.wwww.rsm.website.crt; ssl_certificate_key /etc/nginx/ssl/www.rsm.website.deprotected.key; client_max_body_size 4G; access_log /web/logs/nginx-access.log; error_log /web/logs/nginx-error.log; location /static/ { alias /web/static/; } location /media/ { alias /web/media/; } location / { # an HTTP header important enough to have its own Wikipedia entry: # http://en.wikipedia.org/wiki/X-Forwarded-For proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # enable this if and only if you use HTTPS, this helps Rack # set the proper protocol for doing redirects: # proxy_set_header X-Forwarded-Proto https; # pass the Host: header from the client right along so redirects # can be set properly within the Rack application proxy_set_header Host $http_host; # we don't want nginx trying to do something clever with # redirects, we set the Host: header above already. proxy_redirect off; # set "proxy_buffering off" *only* for Rainbows! when doing # Comet/long-poll stuff. It's also safe to set if you're # using only serving fast clients with Unicorn + nginx. # Otherwise you _want_ nginx to buffer responses to slow # clients, really. # proxy_buffering off; # Try to serve static files from nginx, no point in making an # *application* server like Unicorn/Rainbows! serve static files. if (!-f $request_filename) { proxy_pass http://rsmweb_app_server; break; } } # Error pages error_page 500 502 503 504 /500.html; location = /500.html { root /web/static/; } }
当您的主机www.rsm.websiteparsing为DNS中的服务器IP地址时,您的主机rsm.website不会。 它被另一台服务器完全回答。
看来它正在由一个由Namecheap托pipe的服务器来回答,它正在返回一个redirect到www。 但删除path和查询string。 它似乎没有能力保存它们。
你可以通过修复这个DNSlogging来解决这个问题,使它成为一个指向你的服务器的Alogging,而不是指向Namecheap中断的redirect器的logging。