convertor/docs/範例配置/nginx.example.conf
Your Name 8a84caa503 Refactor Docker Compose examples and documentation
- Updated README.md to include new example files for minimal and production configurations with detailed instructions.
- Added compose.production-alt.example.yml for an annotated production setup.
- Introduced new example files: compose.minimal.example.yml, compose.production.example.yml, nginx.example.conf, and traefik.example.yml for better clarity and usability.
- Removed outdated configuration files and consolidated documentation for OCR language support.
- Adjusted Nginx and Traefik configurations to reflect best practices and added necessary comments for user guidance.
- Minor formatting and consistency improvements across documentation files.
2026-01-24 00:36:58 +08:00

80 lines
2.4 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ConvertX-CN Nginx 反向代理配置範例
# 檔案位置:/etc/nginx/sites-available/convertx
#
# 使用方式:
# 1. 複製到 /etc/nginx/sites-available/convertx
# 2. 將 YOUR_DOMAIN_HERE 替換為你的網域
# 3. ln -s /etc/nginx/sites-available/convertx /etc/nginx/sites-enabled/
# 4. sudo nginx -t && sudo systemctl reload nginx
#
# 必須修改的欄位:
# - YOUR_DOMAIN_HERE共 5 處)
# HTTP → HTTPS 重導向
server {
listen 80;
listen [::]:80;
server_name YOUR_DOMAIN_HERE;
# Let's Encrypt 驗證
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
# 重導向到 HTTPS
location / {
return 301 https://$server_name$request_uri;
}
}
# HTTPS 伺服器
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name YOUR_DOMAIN_HERE;
# SSL 憑證Let's Encrypt
ssl_certificate /etc/letsencrypt/live/YOUR_DOMAIN_HERE/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/YOUR_DOMAIN_HERE/privkey.pem;
# SSL 設定(安全強化)
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
# 安全 Headers
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options DENY;
add_header X-XSS-Protection "1; mode=block";
# 檔案上傳大小限制(依需求調整)
client_max_body_size 500M;
# 上傳超時設定(大檔案需要)
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
# 主要位置
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
# 必要的 Headers
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;
# WebSocket 支援
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# 緩衝設定
proxy_buffering off;
proxy_request_buffering off;
}
}