File tree Expand file tree Collapse file tree 3 files changed +92
-15
lines changed Expand file tree Collapse file tree 3 files changed +92
-15
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ title : Nginx Https 配置
3
+ comments : true
4
+ categories :
5
+ - 工具
6
+ tags :
7
+ - Nginx
8
+ - Https
9
+ date : 2020-11-10 10:58:19
10
+ keywords : Nginx,Https
11
+ description : Nginx Https 配置
12
+ ---
13
+
14
+ # 以下属性中以ssl开头的属性代表与证书配置有关,其他属性请根据自己的需要进行配置。
15
+
16
+ ``` ini
17
+ server {
18
+ listen 443 ssl; #SSL协议访问端口号为443。此处如未添加ssl,可能会造成Nginx无法启动。
19
+ server_name localhost; #将localhost修改为您证书绑定的域名,例如:www.example.com。
20
+ root html;
21
+ index index.html index.htm;
22
+ ssl_certificate cert/domain name.pem; #将domain name.pem替换成您证书的文件名。
23
+ ssl_certificate_key cert/domain name.key; #将domain name.key替换成您证书的密钥文件名。
24
+ ssl_session_timeout 5m;
25
+ ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #使用此加密套件。
26
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #使用该协议进行配置。
27
+ ssl_prefer_server_ciphers on;
28
+ location / {
29
+ root html; #站点目录。
30
+ index index.html index.htm;
31
+ }
32
+ }
33
+ ```
34
+
35
+ # Http 自动 转Https
36
+
37
+ ``` ini
38
+ server {
39
+ listen 80;
40
+ server_name localhost; #将localhost修改为您证书绑定的域名,例如:www.example.com。
41
+ rewrite ^(.*)$ https://$host$1 permanent; #将所有http请求通过rewrite重定向到https。
42
+ location / {
43
+ index index.html index.htm;
44
+ }
45
+ }
46
+ ```
47
+
Original file line number Diff line number Diff line change
1
+ npm run deploy
You can’t perform that action at this time.
0 commit comments