41 lines
1.1 KiB
Plaintext
41 lines
1.1 KiB
Plaintext
# Nginx 反向代理 —— Gitea @ git.shizhui.xyz
|
|
# 证书由 certbot (DNS-01) 签发,已包含 git.shizhui.xyz
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name git.shizhui.xyz;
|
|
|
|
location ^~ /.well-known/acme-challenge/ {
|
|
root /var/www/letsencrypt;
|
|
default_type "text/plain";
|
|
try_files $uri =404;
|
|
}
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
http2 on;
|
|
server_name git.shizhui.xyz;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/shizhui.xyz/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/shizhui.xyz/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_session_cache shared:SSL:10m;
|
|
|
|
# 允许上传较大的仓库/附件
|
|
client_max_body_size 512M;
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1: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;
|
|
}
|
|
}
|