Skip to content

Commit 2ae0e71

Browse files
committed
1. 新增文章source/_posts/nginx证书配置.md
2. 新增一键部署bat
1 parent dd4a436 commit 2ae0e71

File tree

3 files changed

+92
-15
lines changed

3 files changed

+92
-15
lines changed

package-lock.json

Lines changed: 44 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/_posts/nginx证书配置.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+

部署.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm run deploy

0 commit comments

Comments
 (0)