added:增加Linux-server

This commit is contained in:
Vaica committed 2026-06-21 20:42:44 +08:00
1 parent 712116d21d
commit bd96aadb2f
90 files changed
+16784 -1

No files matched your search

@@ -0,0 +1,87 @@
# Write Server Nginx 站点配置
# 反向代理配置
# HTTP 重定向到 HTTPS(可选)
# server {
# listen 80;
# server_name write.your-domain.com;
# return 301 https://$server_name$request_uri;
# }
# 主站点配置
server {
listen 80;
# listen 443 ssl http2; # 启用 HTTPS 时取消注释
server_name write.your-domain.com; # 替换为你的域名
# SSL 配置(启用 HTTPS 时取消注释)
# ssl_certificate /etc/nginx/ssl/fullchain.pem;
# ssl_certificate_key /etc/nginx/ssl/privkey.pem;
# ssl_protocols TLSv1.2 TLSv1.3;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# 日志
access_log /var/log/nginx/write-server-access.log;
error_log /var/log/nginx/write-server-error.log;
# 安全限制
# 限制访问 IP(可选)
# allow 192.168.1.0/24;
# allow 10.0.0.0/8;
# deny all;
# 代理到 Write Server
location / {
proxy_pass http://write-server:8016;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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_cache_bypass $http_upgrade;
# 超时设置
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
# 静态资源缓存
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
proxy_pass http://write-server:8016;
expires 1y;
add_header Cache-Control "public, immutable";
}
# API 路径不缓存
location /api/ {
proxy_pass http://write-server:8016;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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_cache_bypass $http_upgrade;
# 禁止缓存 API 响应
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# 禁止访问隐藏文件
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# 健康检查端点
location /health {
proxy_pass http://write-server:8016/api/stats;
access_log off;
}
}
+48
View File
@@ -0,0 +1,48 @@
# Write Server Nginx 主配置文件
# 用于反向代理和负载均衡
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# 日志格式
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;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
client_max_body_size 50m;
# Gzip 压缩
gzip on;
gzip_vary on;
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/rss+xml application/atom+xml image/svg+xml;
# 安全头
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
# 包含站点配置
include /etc/nginx/conf.d/*.conf;
}