upstream testlink {标签:set,testlink,ssl,header,代理,server,Nginx,proxy From: https://blog.51cto.com/zzzhao/6133146
server 192.168.8.253:80 weight=1 max_fails=3 fail_timeout=3s;
}
server {
listen 80;
listen 443 ssl;
server_name testlink.test.com;
ssl_certificate ../ssl/test.pem;
ssl_certificate_key ../ssl/test.key;
ssl_session_cache shared:SSL:1m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_prefer_server_ciphers on;
if ($server_port = 80 ) {
return 301 https://$host$request_uri;
}
location / {
rewrite ^/(.*)$ /testlink/$1 last;
}
location ~* ^/testlink/.*$ {
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 150;
proxy_buffering off;
proxy_pass http://testlink;
}
error_page 497 https://$host$request_uri;
}