nginx增加了新的server name配置,发现nginx -s reload之后总是不生效。
http和https均可以打开页面,但是页面是别的server页面,使用的证书也是别的server的证书。
新加的配置文件如下
server { listen 80; server_name img31.test.com; access_log /home/test/logs/accesslog/img31.test.com/img31.test.com_access.log main; location / { proxy_set_header Cookie $http_cookie; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Test-CDN-Proxy-Origin-Host cdn.m.test.cn; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; index index.html index.htm; proxy_pass http://img31.test.com; } error_page 404 500 502 503 504 = http://www.test.com/404.html; } server { listen 443; server_name img31.test.com; access_log /home/test/logs/accesslog/img31.test.com/img31.test.com_access.log main; ssl on; ssi_types text/shtml; ssl_certificate crt/test-server.crt; ssl_certificate_key crt/test-server.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; location / { proxy_set_header Cookie $http_cookie; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Test-CDN-Proxy-Origin-Host cdn.m.test.cn; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; index index.html index.htm; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://img31.test.com; } error_page 404 500 502 503 504 = http://www.test.com/404.html; }
配置不生效时,打开了其他server的80端口和443端口
标签:set,修改,header,server,nginx,proxy,生效,test,com From: https://www.cnblogs.com/mo3408/p/16908587.html