63 lines
1.6 KiB
Plaintext
63 lines
1.6 KiB
Plaintext
# Write Server Nginx 站点配置
|
||
|
||
# HTTP -> HTTPS 重定向
|
||
server {
|
||
listen 80;
|
||
server_name post.usj.cc;
|
||
|
||
# Let's Encrypt 验证
|
||
location /.well-known/acme-challenge/ {
|
||
root /var/www/certbot;
|
||
}
|
||
|
||
# 其他请求重定向到 HTTPS
|
||
location / {
|
||
return 301 https://$host$request_uri;
|
||
}
|
||
}
|
||
|
||
# HTTPS 主站
|
||
server {
|
||
listen 443 ssl http2;
|
||
server_name post.usj.cc;
|
||
|
||
ssl_certificate /etc/nginx/ssl/fullchain.pem;
|
||
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
|
||
ssl_protocols TLSv1.2 TLSv1.3;
|
||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||
|
||
access_log /var/log/nginx/write-server-access.log;
|
||
error_log /var/log/nginx/write-server-error.log;
|
||
|
||
# 静态文件(Service Worker)
|
||
location /sw.js {
|
||
alias /etc/nginx/sw.js;
|
||
add_header Content-Type application/javascript;
|
||
add_header Cache-Control "no-cache, no-store";
|
||
}
|
||
|
||
# 所有请求代理到 write-server
|
||
location / {
|
||
proxy_pass http://write-server:8016;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Upgrade $http_upgrade;
|
||
proxy_set_header Connection 'upgrade';
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_cache_bypass $http_upgrade;
|
||
|
||
proxy_connect_timeout 60s;
|
||
proxy_send_timeout 60s;
|
||
proxy_read_timeout 120s;
|
||
client_max_body_size 50m;
|
||
}
|
||
|
||
location ~ /\. {
|
||
deny all;
|
||
access_log off;
|
||
log_not_found off;
|
||
}
|
||
}
|