nginx配置重定向 2019-06-25 开发笔记 文章目录 实现功能未配置重定向配置重定向 实现功能 http重定向到https wxy.email重定向到www.wxy.email 未配置重定向12345678910111213141516171819server { # listen 80; # 添加 listen 443 ssl; server_name www.wxy.email wxy.email; # 添加ssl证书配置 # ssl on; ssl_certificate /home/lls/wxy.email.crt; ssl_certificate_key /home/lls/wxy.email.key; ssl_session_timeout 5m; charset utf-8; location / { root /home/blog/blog; index index.html; }} 配置重定向 在原来的server外面再添加一个server, 12345server { listen 80; server_name www.wxy.email wxy.email; rewrite ^(.*)$ https://www.wxy.email$1 permanent;}