nginx https跳转

server {
listen 80;
server_name shareproject.hydee.cn;
listen 443 ssl;
ssl_certificate _.hydee.cn_bundle.crt;
ssl_certificate_key _.hydee.cn.key;
#charset koi8-r;
location / {
if ( $scheme = http ){
rewrite ^/(.*)$ https://shareproject.hydee.cn/$1 redirect;
}
proxy_pass http://10.200.25.105:80;
# proxy_redirect default;
proxy_read_timeout 30s;
proxy_connect_timeout 30s;
# proxy_send_timeout 600;
include vhosts/ip.rule;
}

location /open {
default_type application/json;
alias /data/h5/open/;
index url.json;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

  1. server {  
  2.     listen  192.168.1.111:80;  
  3.     server_name test.com;  
  4.       
  5.     rewrite ^(.*)$  https://$host$1 permanent;  
  6. }  
要有多努力才能对得起奔波的脚步和身上的期望
原文地址:https://www.cnblogs.com/hxfcodelife/p/14927853.html