在server中添加

  1. rewrite ^(.*)$ https://$host$1 permanent;

具体案例实现

  1. server{
  2. listen 80;
  3. server_name ***.chumenwai.cn;
  4. #rewrite ^(.*)$ https://$host$1 permanent;
  5. location / {
  6. proxy_pass http://tomcat_cmzwht;
  7. proxy_store off;
  8. proxy_redirect off;
  9. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  10. proxy_set_header X-Real-IP $remote_addr;
  11. proxy_set_header Host $http_host;
  12. client_max_body_size 100m;
  13. }
  14. }