实现功能

  • http重定向到https
  • wxy.email重定向到www.wxy.email

未配置重定向

  • 不知道怎么配置nginx看这里

    server {     # 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,

    server {     listen 80;     server_name  www.wxy.email wxy.email;     rewrite ^(.*)$ https://www.wxy.email$1 permanent;}

本文链接:时光不写博客-nginx配置重定向

收藏 打印