60 lines
1.5 KiB
Plaintext
60 lines
1.5 KiB
Plaintext
server {
|
|
listen 80;
|
|
server_name gitea.mzh.one;
|
|
|
|
# 将HTTP请求重定向到HTTPS
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
# Let's Encrypt验证路径
|
|
location /.well-known/acme-challenge/ {
|
|
root /www;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
http2 on;
|
|
server_name gitea.mzh.one;
|
|
|
|
# SSL证书配置
|
|
ssl_certificate /ssl/gitea.mzh.one/gitea.mzh.one.pem;
|
|
ssl_certificate_key /ssl/gitea.mzh.one/gitea.mzh.one.key;
|
|
ssl_session_timeout 5m;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
ssl_prefer_server_ciphers on;
|
|
|
|
# 反向代理到Gitea服务
|
|
location / {
|
|
proxy_pass http://gitea:3000;
|
|
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;
|
|
|
|
# WebSocket支持
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
# 超时设置
|
|
proxy_read_timeout 600s;
|
|
proxy_connect_timeout 600s;
|
|
proxy_send_timeout 600s;
|
|
|
|
# 缓冲设置
|
|
proxy_buffer_size 128k;
|
|
proxy_buffers 4 256k;
|
|
proxy_busy_buffers_size 256k;
|
|
}
|
|
|
|
# 大文件上传设置
|
|
client_max_body_size 512M;
|
|
|
|
# 错误页面
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
} |