0908
This commit is contained in:
30
nginx/conf.d/00-http.conf
Normal file
30
nginx/conf.d/00-http.conf
Normal file
@@ -0,0 +1,30 @@
|
||||
# HTTP 入口:ACME 验证 + HTTPS 跳转
|
||||
#
|
||||
# 【关键】这个文件必须常驻,且不能引用任何证书文件。
|
||||
# 首次部署时证书尚不存在,如果 nginx 加载了带 ssl_certificate 的 server 块,
|
||||
# 会直接 [emerg] cannot load certificate 退出;而申请证书又必须要有 80 端口可用
|
||||
# —— 形成死锁。因此所有 HTTPS server 块统一放到 /etc/nginx/ssl.d/,
|
||||
# 由 nginx/enable-ssl.sh 在证书就绪后再启用。
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
# 健康检查探针(容器 HEALTHCHECK 使用),不跟随 301
|
||||
location = /healthz {
|
||||
access_log off;
|
||||
default_type text/plain;
|
||||
return 200 "ok\n";
|
||||
}
|
||||
|
||||
# ACME HTTP-01 验证
|
||||
# certbot 通过 webroot 写入 /var/www/certbot/.well-known/acme-challenge/<token>
|
||||
# 该目录是 certbot-webroot 卷,nginx 以只读方式挂载
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
default_type text/plain;
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
# HTTP -> HTTPS 重定向(ACME 验证由独立 certbot 服务处理)
|
||||
server {
|
||||
listen 80;
|
||||
server_name fastgpt.stonelan.cn gitea.stonelan.cn image.stonelan.cn registry.stonelan.cn www.stonelan.cn;
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
proxy_pass http://certbot:80;
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
# HTTPS 配置
|
||||
server {
|
||||
listen 8443 ssl;
|
||||
server_name fastgpt.stonelan.cn;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/fastgpt.stonelan.cn/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/fastgpt.stonelan.cn/privkey.pem;
|
||||
|
||||
# SSL 优化配置
|
||||
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;
|
||||
ssl_prefer_server_ciphers off;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_tickets off;
|
||||
|
||||
location / {
|
||||
proxy_pass http://10.0.3.173: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;
|
||||
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
|
||||
client_max_body_size 100M;
|
||||
proxy_buffering off;
|
||||
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_min_length 1024;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_types
|
||||
text/plain
|
||||
text/css
|
||||
text/xml
|
||||
text/javascript
|
||||
application/json
|
||||
application/javascript
|
||||
application/xml+rss
|
||||
application/atom+xml
|
||||
image/svg+xml;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
# HTTPS 配置
|
||||
server {
|
||||
listen 8443 ssl;
|
||||
server_name gitea.stonelan.cn;
|
||||
client_max_body_size 200m;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/gitea.stonelan.cn/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/gitea.stonelan.cn/privkey.pem;
|
||||
|
||||
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;
|
||||
ssl_prefer_server_ciphers off;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_tickets off;
|
||||
|
||||
location / {
|
||||
proxy_pass http://gitea:3000;
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
# HTTPS 配置
|
||||
server {
|
||||
listen 8443 ssl;
|
||||
server_name image.stonelan.cn;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/image.stonelan.cn/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/image.stonelan.cn/privkey.pem;
|
||||
|
||||
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;
|
||||
ssl_prefer_server_ciphers off;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_tickets off;
|
||||
|
||||
location / {
|
||||
proxy_pass http://10.0.3.173:3004;
|
||||
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_connect_timeout 60s;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
# HTTPS 配置
|
||||
server {
|
||||
listen 8443 ssl;
|
||||
server_name registry.stonelan.cn;
|
||||
client_max_body_size 500m;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/registry.stonelan.cn/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/registry.stonelan.cn/privkey.pem;
|
||||
|
||||
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;
|
||||
ssl_prefer_server_ciphers off;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_tickets off;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3005;
|
||||
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_connect_timeout 60s;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
# HTTPS 配置
|
||||
server {
|
||||
listen 8443 ssl;
|
||||
server_name www.stonelan.cn;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/www.stonelan.cn/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/www.stonelan.cn/privkey.pem;
|
||||
|
||||
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;
|
||||
ssl_prefer_server_ciphers off;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_tickets off;
|
||||
|
||||
location / {
|
||||
proxy_pass http://10.0.3.173:8080;
|
||||
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_connect_timeout 60s;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user