feat: 项目库上线(七阶段流程 + Gitea 同步 + 首页入口)
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
# =========================================================
|
||||
# an.xiaoan.xyz - 本地 origin Nginx(9001,HTTP)
|
||||
#
|
||||
# 公网链路:
|
||||
# Browser -> 云端 Nginx 443 (TLS, 证书) -> frps:80
|
||||
# -> frpc -> 本机 Nginx:9001 -> Gunicorn:8000 -> Django
|
||||
#
|
||||
# 注意:现有 frpc 的 blog_sit 代理是 type="http",所以本机 9001 必须是 HTTP。
|
||||
# 如果你改成 type="https" / TCP,请把本文件改为 listen 9001 ssl 并使用证书。
|
||||
# =========================================================
|
||||
|
||||
upstream an_xiaoan_app {
|
||||
server 127.0.0.1:8000;
|
||||
keepalive 16;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 9001;
|
||||
server_name an.xiaoan.xyz;
|
||||
|
||||
server_tokens off;
|
||||
client_max_body_size 220m;
|
||||
client_body_timeout 300s;
|
||||
send_timeout 300s;
|
||||
|
||||
access_log /var/log/nginx/an.xiaoan.xyz.access.log;
|
||||
error_log /var/log/nginx/an.xiaoan.xyz.error.log warn;
|
||||
|
||||
# 云端 Nginx 会传 X-Forwarded-Proto: https;若没有(例如直接访问本机),
|
||||
# 也按 HTTPS 处理,因为公网入口固定是云端 443。
|
||||
set $forwarded_proto $http_x_forwarded_proto;
|
||||
if ($forwarded_proto = "") {
|
||||
set $forwarded_proto https;
|
||||
}
|
||||
|
||||
# AI 摘要流式接口:关闭缓冲,保证逐段到达浏览器
|
||||
location = /digest/stream/ {
|
||||
proxy_pass http://an_xiaoan_app;
|
||||
proxy_http_version 1.1;
|
||||
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-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $forwarded_proto;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
proxy_connect_timeout 10s;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
alias /home/myserver/my-site/staticfiles/;
|
||||
expires 30d;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location /media/ {
|
||||
alias /home/myserver/my-site/media/;
|
||||
expires 7d;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://an_xiaoan_app;
|
||||
proxy_http_version 1.1;
|
||||
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-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $forwarded_proto;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
proxy_connect_timeout 10s;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_request_buffering off;
|
||||
}
|
||||
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header X-Frame-Options SAMEORIGIN always;
|
||||
add_header Referrer-Policy strict-origin-when-cross-origin always;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# 可选:HTTP -> HTTPS 跳转
|
||||
# 需要 frpc 额外增加一个 type="http" 的代理,localPort=9002
|
||||
server {
|
||||
listen 9002;
|
||||
server_name an.xiaoan.xyz;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
# =========================================================
|
||||
# an.xiaoan.xyz - 本地 origin Nginx(9001,HTTPS)
|
||||
#
|
||||
# 公网链路(云端只跑 frps):
|
||||
# Browser -> frps:443 (SNI, 不终止 TLS)
|
||||
# -> frpc (type=https) -> 本机 Nginx:9001 (TLS, 本证书)
|
||||
# -> Gunicorn:8000 -> Django
|
||||
#
|
||||
# 注意:frps 的 vhostHTTPSPort = 443;frpc 的 blog_sit 必须 type="https"。
|
||||
# =========================================================
|
||||
|
||||
upstream an_xiaoan_app {
|
||||
server 127.0.0.1:8000;
|
||||
keepalive 16;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 9001 ssl http2;
|
||||
server_name an.xiaoan.xyz;
|
||||
|
||||
ssl_certificate /etc/nginx/ssl/an.xiaoan.xyz/an.xiaoan.xyz_bundle.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/an.xiaoan.xyz/an.xiaoan.xyz.key;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
|
||||
ssl_prefer_server_ciphers off;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_tickets off;
|
||||
|
||||
server_tokens off;
|
||||
client_max_body_size 220m;
|
||||
client_body_timeout 300s;
|
||||
send_timeout 300s;
|
||||
|
||||
access_log /var/log/nginx/an.xiaoan.xyz.access.log;
|
||||
error_log /var/log/nginx/an.xiaoan.xyz.error.log warn;
|
||||
|
||||
# 云端 Nginx 会传 X-Forwarded-Proto: https;若没有(例如直接访问本机),
|
||||
# 也按 HTTPS 处理,因为公网入口固定是云端 443。
|
||||
set $forwarded_proto $http_x_forwarded_proto;
|
||||
if ($forwarded_proto = "") {
|
||||
set $forwarded_proto https;
|
||||
}
|
||||
|
||||
# AI 摘要流式接口:关闭缓冲,保证逐段到达浏览器
|
||||
location = /digest/stream/ {
|
||||
proxy_pass http://an_xiaoan_app;
|
||||
proxy_http_version 1.1;
|
||||
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-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $forwarded_proto;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
proxy_connect_timeout 10s;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
alias /home/myserver/my-site/staticfiles/;
|
||||
expires 30d;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location /media/ {
|
||||
alias /home/myserver/my-site/media/;
|
||||
expires 7d;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://an_xiaoan_app;
|
||||
proxy_http_version 1.1;
|
||||
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-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $forwarded_proto;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
proxy_connect_timeout 10s;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_request_buffering off;
|
||||
}
|
||||
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header X-Frame-Options SAMEORIGIN always;
|
||||
add_header Referrer-Policy strict-origin-when-cross-origin always;
|
||||
}
|
||||
Reference in New Issue
Block a user