-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx2.conf
85 lines (68 loc) · 2.48 KB
/
nginx2.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
user root;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;
include /etc/nginx/mime.types;
default_type application/octet-stream;
types {
application/wasm wasm;
}
include /etc/nginx/conf.d/*.conf;
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
ssl on; # 开启 Nginx SSL 模块
ssl_certificate "/home/yipooo/cert/cert.pem"; # 网站新证书路径
ssl_certificate_key "/home/yipooo/cert/cert.key"; # 网站新私钥路径
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers PROFILE=SYSTEM;
ssl_prefer_server_ciphers on;
server_name www.yipooo.com;
root /home/yipooo/www;
index index.html index.htm index.php library.html library.htm;
include /etc/nginx/default.d/*.conf;
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
# 新增 server 配置块,用于处理 picsponge.yipooo.com 的 HTTP 请求
server {
listen 80;
server_name picsponge.yipooo.com;
return 301 https://$host$request_uri;
}
# 新增 server 配置块,用于处理 picsponge.yipooo.com 的 HTTPS 请求
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name picsponge.yipooo.com;
ssl_certificate "/home/yipooo/cert/cert2.pem"; # 替换为实际的 SSL 证书路径
ssl_certificate_key "/home/yipooo/cert/cert2.key"; # 替换为实际的 SSL 私钥路径
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}