我试图基于路径控制Nginx服务器上的HTTPS重定向。我希望/.well-known/pki-validation / ...保留HTTP,其他所有内容都重定向到HTTPS。我的服务器块设置如下,但是所有内容都重定向到HTTPS。有什么建议吗?
server {
# Port to listen on, can also be set in IP:PORT format
listen 80 default_server;
server_name _;
root /opt/bitnami/nginx/html;
location /.well-known/pki-validation/ {
root /opt/bitnami/nginx/html/well-known/pki-validation;
allow all;
}
location / {
return 301 https://$host$request_uri;
}
# include "/opt/bitnami/nginx/conf/bitnami/*.conf";
}