实现功能


未配置重定向

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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,
1
2
3
4
5
server {
listen 80;
server_name www.wxy.email wxy.email;
rewrite ^(.*)$ https://www.wxy.email$1 permanent;
}