我目前正在https
我的域名的二级和三级上提供服务(通配符),并将所有http
流量重定向到https
这些。现在我想为 4 级子域名提供服务http
仅有的,因为我无法以以下形式获取任何域的证书*.*.example.com
# Now
example.com -> https:
*.example.com -> https:
# What I want
*.*.example.com -> http:
我尝试了以下配置,但它仍然重定向到 https。.example.com:
server {
listen 80;
listen [::]:80;
server_name example.com *.example.com;
include /etc/nginx/headers.conf;
location / {
return 301 https://$host$request_uri;
}
access_log off;
}
server {
listen 80;
listen [::]:80;
server_name *.*.example.com;
include /etc/nginx/headers.conf;
location / {
proxy_pass http://127.0.0.1:8087/;
proxy_set_header Host $host;
}
access_log off;
}
server {
server_name example.com *.example.com;
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /cert.pem;
ssl_certificate_key /key.pem;
include /etc/nginx/headers.conf;
location / {
proxy_pass http://127.0.0.1:8087/;
proxy_set_header Host $host;
}
access_log off;
}
编辑:优先级不相关。PCRE 正在运行。