1.http强制跳转https
upstream testa.xxx.com{
server 127.0.0.1:8081
}
server {
server_name testa.xxx.com
return 301 https://$server_name$request_uri
}
server {
listen 443
server_name testa.xxx.com
ssl on
root html
index index.html index.htm
ssl_certificate cert/2559281_testa.xxx.com.pem
ssl_certificate_key cert/2559281_testa.xxx.com.key
ssl_session_timeout 5m
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4
ssl_protocols TLSv1 TLSv1.1 TLSv1.2
ssl_prefer_server_ciphers on
location /{
proxy_pass http://testa.xxx.com
}
}
2.https强制跳转http
upstream testa.xxx.com{
server 127.0.0.1:8081
}
server {
server_name testa.xxx.com
location /{
proxy_pass http://testa.xxx.com
}
}
server {
listen 443
server_name testa.xxx.com
return 301 http://$server_name$request_uri
}