nginx重复位置“/&引用;错误
当scheme为http且位置为时,我想重定向到https/nginx重复位置“/&引用;错误,nginx,Nginx,当scheme为http且位置为时,我想重定向到https/ server { listen 80; server_name bla; location / { return 301 https://bla; } include fs.inc; } 现在,问题是:fs.inc包含了另一个“location/”,即使从未调用过,nginx配置测试也会失败,在fs.inc:1中出现错误replicate loca
server {
listen 80;
server_name bla;
location / {
return 301 https://bla;
}
include fs.inc;
}
现在,问题是:fs.inc包含了另一个“location/”,即使从未调用过,nginx配置测试也会失败,在fs.inc:1中出现错误replicate location/”
如何解决此问题?您需要另一个服务器块:
server {
listen 443;
server_name bla; # make sure this is the same
# add your ssl specific directives here
location / {
alias /var/www/secured/;
}
}
server {
listen 80;
server_name bla;
return 301 https://$request_uri;
}
这是一个全局重定向hm,但我只想在location为only/时重定向到https,而不是更多。你是说如果链接是/hello,你想要它http吗?但是如果它/你想重定向到https?如果有人将/hello?location=/
标记为书签,则表示完全匹配,而不是前缀