Nginx配置常驻进程程序示例

配置示例

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
server {
listen 80;
server_name domain.com;

access_log off;
error_log /dev/null crit;

return 308 https://$host$request_uri;
}

server {
listen 443 ssl;
server_name domain.com;

access_log /log_path/xxx.log;
error_log /log_path/xxx_error.log;

ssl_certificate /ssl_cert_path/cert.pem;
ssl_certificate_key /ssl_cert_path/key.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;

location / {
proxy_pass http://127.0.0.1:8080;

proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host:$server_port;
}

location /.well-known/ {
root /tmp/acme.sh;
}
}

评论