Ssl 使用nginx config为我的服务器上的单个目录强制https
我试图通过在我的nginx配置文件中放置重写规则来强制服务器上的单个子目录使用SSL 例如,当用户转到example.com/billing或example.com/billing/user时,他们会被带到或 我已安装SSL证书等。以下是我的nginx服务器块中的规则:Ssl 使用nginx config为我的服务器上的单个目录强制https,ssl,nginx,https,nginx-location,Ssl,Nginx,Https,Nginx Location,我试图通过在我的nginx配置文件中放置重写规则来强制服务器上的单个子目录使用SSL 例如,当用户转到example.com/billing或example.com/billing/user时,他们会被带到或 我已安装SSL证书等。以下是我的nginx服务器块中的规则: #billing location location /billing/ { if (!-e $request_filename){ rewrite ^/billing/(.*)$ /billing/in
#billing location
location /billing/ {
if (!-e $request_filename){
rewrite ^/billing/(.*)$ /billing/index.php?request=$1 last;
}
}
有没有办法修改此规则以包括强制https?我希望您有两个服务器块,一个用于http,另一个用于http SSL连接;在http服务器块中,在
/billing/
位置块中添加重定向到https将解决此问题
server {
listen 80;
location /billing/ {
# 301 for permanent redirect
return 301 https://$host$request_uri;
}
}
我希望您有两个服务器块,一个用于http,另一个用于http SSL连接;在http服务器块中,在
/billing/
位置块中添加重定向到https将解决此问题
server {
listen 80;
location /billing/ {
# 301 for permanent redirect
return 301 https://$host$request_uri;
}
}