0
我已經改變了我的conf文件,以便在時域中的用戶類型,而WWW重定向到域以www:重定向過多 - 改變裸體網址 - > www.example.com
server_name example.com;
return 301 $scheme://www.example.com$request_uri;
我也希望我的HTTPS下的任何/用戶
我得到的錯誤也可能重定向,我哪裏錯了?
所以我必須:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/example.com/site;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name example.com;
return 301 $scheme://www.example.com$request_uri;
location/{
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location /user {
rewrite^https://$http_host$request_uri? permanent;
}
}
對於443端口:
server {
listen 443;
server_name example.com;
return 301 $scheme://www.example.com$request_uri;
root /var/www/example.com/site;
index index.html index.htm;
ssl on;
ssl_certificate //path here
ssl_certificate_key //path here
location/{
rewrite^http://$http_host$request_uri? permanent;
}
location /user {
}
}