Files
novalon-website/nginx.conf
T
张翔 ece3c86e29 feat: 添加Docker部署配置和文档
- 创建docker-compose.yml多容器编排配置
- 创建Dockerfile多阶段构建配置
- 创建nginx.conf反向代理和SSL配置
- 创建.env.example环境变量示例文件
- 创建setup-ssl.sh SSL证书配置脚本
- 创建deploy.sh自动化部署脚本
- 创建DEPLOYMENT.md详细部署文档
- 配置容器名称为novalon-website,版本1.0.0
- 配置端口映射80和443
- 配置Let's Encrypt免费SSL证书
- 配置域名novalon.cn,服务器IP 139.155.109.62
- 配置ICP备案号:蜀ICP备2026013658号
2026-03-26 19:27:18 +08:00

99 lines
2.9 KiB
Nginx Configuration File

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
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 20M;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+text text/javascript;
upstream novalon_app {
server novalon-website:3000;
}
server {
listen 80;
server_name novalon.cn www.novalon.cn;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl http2;
server_name novalon.cn www.novalon.cn;
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;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
location / {
proxy_pass http://novalon_app;
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 /_next/static {
proxy_pass http://novalon_app;
proxy_cache_valid 200 60m;
add_header Cache-Control "public, immutable, max-age=31536000, s-maxage=31536000";
}
location /static {
proxy_pass http://novalon_app;
proxy_cache_valid 200 60m;
add_header Cache-Control "public, immutable, max-age=31536000, s-maxage=31536000";
}
}
}