Skip to content

Commit febf0e3

Browse files
author
gclm
committed
fix(增加 nginx 默认配置)
1 parent 820f455 commit febf0e3

File tree

5 files changed

+44
-0
lines changed

5 files changed

+44
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# GZip 和 Brotli
2+
gzip on;
3+
gzip_comp_level 6;
4+
gzip_min_length 1k;
5+
gzip_types text/plain text/css text/xml text/javascript text/x-component application/json application/javascript application/x-javascript application/xml application/xhtml+xml application/rss+xml application/atom+xml application/x-font-ttf application/vnd.ms-fontobject image/svg+xml image/x-icon font/opentype;
6+
brotli on;
7+
brotli_comp_level 6;
8+
brotli_min_length 1k;
9+
brotli_types text/plain text/css text/xml text/javascript text/x-component application/json application/javascript application/x-javascript application/xml application/xhtml+xml application/rss+xml application/atom+xml application/x-font-ttf application/vnd.ms-fontobject image/svg+xml image/x-icon font/opentype;

config/nginx/snippets/default.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
proxy_redirect off;
2+
proxy_headers_hash_max_size 512;
3+
proxy_headers_hash_bucket_size 128;
4+
proxy_set_header Host $host;
5+
proxy_set_header X-Forwarded-Proto $scheme;
6+
proxy_set_header X-Real-IP $remote_addr;
7+
proxy_set_header X-Forwarded-For $remote_addr;
8+
proxy_set_header X-Forwarded-Host $server_name;
9+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

config/nginx/snippets/ssl.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#证书部分
2+
#ssl_certificate /etc/nginx/ssl/fullchain.cer;
3+
#ssl_certificate_key /etc/nginx/ssl/gclmit.club.key;
4+
#ssl_dhparam /etc/nginx/ssl/dhparam.pem;
5+
6+
#TLS 握手优化
7+
ssl_session_cache shared:SSL:1m;
8+
ssl_session_timeout 5m;
9+
keepalive_timeout 75s;
10+
keepalive_requests 100;
11+
12+
#TLS 版本控制
13+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
14+
ssl_ciphers 'TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+ECDSA+AES128:EECDH+aRSA+AES128:RSA+AES128:EECDH+ECDSA+AES256:EECDH+aRSA+AES256:RSA+AES256:EECDH+ECDSA+3DES:EECDH+aRSA+3DES:RSA+3DES:!MD5';
15+
16+
# 开启 1.3 o-RTT
17+
ssl_early_data on;

include/nginx.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ module_hotfixes=true
2424
EOF
2525

2626
yum install -y nginx
27+
mkdir -p /etc/nginx/snippets
28+
wget -0 /etc/nginx/snippets/compression.conf https://gitee.com/gclm/one-key-linux/raw/master/config/nginx/snippets/compression.conf
29+
wget -0 /etc/nginx/snippets/default.conf https://gitee.com/gclm/one-key-linux/raw/master/config/nginx/snippets/default.conf
30+
wget -0 /etc/nginx/snippets/ssl.conf https://gitee.com/gclm/one-key-linux/raw/master/config/nginx/snippets/ssl.conf
2731
clear
2832
echo "Nginx 安装完成"
2933
nginx -v

include/tengine-2.3.2.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ chmod 700 /var/cache/nginx/*
6262
# nginx 默认配置
6363
mkdir /etc/nginx/conf.d
6464
wget -O nginx.conf https://gitee.com/gclm/one-key-linux/raw/master/config/nginx/nginx.conf
65+
66+
mkdir /etc/nginx/snippets
67+
wget -0 /etc/nginx/snippets/compression.conf https://gitee.com/gclm/one-key-linux/raw/master/config/nginx/snippets/compression.conf
68+
wget -0 /etc/nginx/snippets/default.conf https://gitee.com/gclm/one-key-linux/raw/master/config/nginx/snippets/default.conf
69+
wget -0 /etc/nginx/snippets/ssl.conf https://gitee.com/gclm/one-key-linux/raw/master/config/nginx/snippets/ssl.conf
6570
}
6671

6772
main(){

0 commit comments

Comments
 (0)