827
This commit is contained in:
@@ -1,39 +1,39 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name navidrome.deepseak.icu;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:4533;
|
||||
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;
|
||||
|
||||
# 针对Navidrome的特殊配置
|
||||
# 支持大文件上传和流媒体传输
|
||||
client_max_body_size 100M;
|
||||
proxy_buffering off;
|
||||
|
||||
# 启用gzip压缩
|
||||
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;
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
server_name navidrome.deepseak.icu;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:4533;
|
||||
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;
|
||||
|
||||
# 针对Navidrome的特殊配置
|
||||
# 支持大文件上传和流媒体传输
|
||||
client_max_body_size 100M;
|
||||
proxy_buffering off;
|
||||
|
||||
# 启用gzip压缩
|
||||
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;
|
||||
}
|
||||
}
|
||||
254
nginx/nginx.conf
254
nginx/nginx.conf
@@ -1,127 +1,127 @@
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name active.deepseak.icu;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/active.deepseak.icu/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/active.deepseak.icu/privkey.pem;
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
client_max_body_size 5m;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3006;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name bbs.deepseak.icu;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/bbs.deepseak.icu/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/bbs.deepseak.icu/privkey.pem;
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
client_max_body_size 5m;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3003;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name image.deepseak.icu;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/image.deepseak.icu/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/image.deepseak.icu/privkey.pem;
|
||||
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1: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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# 添加gitea的HTTP代理
|
||||
server {
|
||||
listen 80;
|
||||
server_name gitea.deepseak.icu;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3002;
|
||||
# 添加代理超时配置
|
||||
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;
|
||||
|
||||
}
|
||||
client_max_body_size 50m;
|
||||
}
|
||||
|
||||
# 增加一个空的server,用于申请证书
|
||||
server {
|
||||
listen 80;
|
||||
server_name aaa.deepseak.icu;
|
||||
|
||||
}
|
||||
}
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name active.deepseak.icu;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/registry.deepseak.icu/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/registry.deepseak.icu/privkey.pem;
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
client_max_body_size 5m;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3006;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name bbs.deepseak.icu;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/registry.deepseak.icu/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/registry.deepseak.icu/privkey.pem;
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
client_max_body_size 5m;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3003;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name image.deepseak.icu;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/registry.deepseak.icu/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/registry.deepseak.icu/privkey.pem;
|
||||
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1: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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# 添加gitea的HTTP代理
|
||||
server {
|
||||
listen 80;
|
||||
server_name gitea.deepseak.icu;
|
||||
|
||||
location / {
|
||||
proxy_pass http://10.0.3.14:3002;
|
||||
# 添加代理超时配置
|
||||
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;
|
||||
|
||||
}
|
||||
client_max_body_size 50m;
|
||||
}
|
||||
|
||||
# 增加一个空的server,用于申请证书
|
||||
server {
|
||||
listen 80;
|
||||
server_name aaa.deepseak.icu;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 检查并创建nginx用户
|
||||
if ! id -u nginx >/dev/null 2>&1; then
|
||||
echo "创建nginx用户..."
|
||||
sudo useradd -r -s /sbin/nologin nginx
|
||||
fi
|
||||
|
||||
# 创建 conf.d 目录(如果不存在)
|
||||
mkdir -p /etc/nginx/conf.d
|
||||
sudo mkdir -p /etc/nginx/conf.d
|
||||
|
||||
# 备份并覆盖 nginx.conf 文件
|
||||
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
|
||||
cp nginx.conf /etc/nginx/
|
||||
sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
|
||||
sudo cp nginx.conf /etc/nginx/
|
||||
|
||||
# 备份并覆盖 conf.d 目录下的所有 .conf 文件
|
||||
for conf in conf.d/*.conf; do
|
||||
filename=$(basename "$conf")
|
||||
cp "/etc/nginx/conf.d/$filename" "/etc/nginx/conf.d/${filename}.bak" 2>/dev/null || true
|
||||
cp "$conf" /etc/nginx/conf.d/
|
||||
sudo cp "/etc/nginx/conf.d/$filename" "/etc/nginx/conf.d/${filename}.bak" 2>/dev/null || true
|
||||
sudo cp "$conf" /etc/nginx/conf.d/
|
||||
done
|
||||
|
||||
# 测试并重载配置
|
||||
if nginx -t; then
|
||||
systemctl reload nginx
|
||||
if sudo nginx -t; then
|
||||
sudo systemctl reload nginx
|
||||
echo "配置已生效,HTTPS已启用"
|
||||
else
|
||||
echo "配置测试失败,已恢复备份"
|
||||
# 恢复 nginx.conf 备份
|
||||
cp /etc/nginx/nginx.conf.bak /etc/nginx/nginx.conf
|
||||
sudo cp /etc/nginx/nginx.conf.bak /etc/nginx/nginx.conf
|
||||
# 恢复 conf.d 目录下的所有 .conf 文件备份
|
||||
for conf in conf.d/*.conf; do
|
||||
filename=$(basename "$conf")
|
||||
mv -f "/etc/nginx/conf.d/${filename}.bak" "/etc/nginx/conf.d/$filename" 2>/dev/null || true
|
||||
sudo mv -f "/etc/nginx/conf.d/${filename}.bak" "/etc/nginx/conf.d/$filename" 2>/dev/null || true
|
||||
done
|
||||
fi
|
||||
Reference in New Issue
Block a user