我正在尝试使用两个服务器块配置 Nginx,以区分特定子域 (subdomain.example.com) 和其余域 (*.example.com) 的超时。但是,我的尝试导致以下错误:
nginx:[警告] 0.0.0.0:443 上冲突的服务器名称“specific_subdomain.example.com”,已忽略
这是我的两个服务器块:
server {
client_body_timeout 60;
client_header_timeout 60;
send_timeout 60;
listen 443 ssl http2;
server_name *.example.com example.com www.example.com;
ssl_certificate /etc/example.com-0001.pem;
ssl_certificate_key /etc/example.com-0001/privkey.pem;
location ~ /.well-known {
default_type "text/plain";
root /var/www/lets/;
}
location / {
proxy_read_timeout 60; # Timeout for reading a response from the proxied server
proxy_pass http: //127.0.0.1:8083;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
client_body_timeout 10;
client_header_timeout 10;
send_timeout 10;
listen 443 ssl http2;
server_name subdomain.example.com;
ssl_certificate /etc/example.com-0001.pem;
ssl_certificate_key /etc/example.com-0001/privkey.pem;
location ~ /.well-known {
default_type "text/plain";
root /var/www/lets/;
}
location / {
proxy_read_timeout 10; # Timeout for reading a response from the proxied server
proxy_pass http: //127.0.0.1:8083;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
问题:如何配置 Nginx 以使 subdomain.example.com 和 *.example.com 设置不同的超时时间,而不会遇到冲突的服务器名称错误?