69 lines
2.1 KiB
Nginx Configuration File
69 lines
2.1 KiB
Nginx Configuration File
server {
|
||
listen 80;
|
||
server_name onboarding.newassetchain.io;
|
||
|
||
# 重定向到HTTPS
|
||
return 301 https://$server_name$request_uri;
|
||
}
|
||
|
||
server {
|
||
listen 443 ssl http2;
|
||
server_name onboarding.newassetchain.io;
|
||
|
||
# SSL证书配置(由宝塔面板自动生成)
|
||
ssl_certificate /www/server/panel/vhost/cert/onboarding.newassetchain.io/fullchain.pem;
|
||
ssl_certificate_key /www/server/panel/vhost/cert/onboarding.newassetchain.io/privkey.pem;
|
||
ssl_protocols TLSv1.2 TLSv1.3;
|
||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||
|
||
# 日志
|
||
access_log /var/log/nginx/nac-onboarding-access.log;
|
||
error_log /var/log/nginx/nac-onboarding-error.log;
|
||
|
||
# 静态文件
|
||
location / {
|
||
root /opt/nac-onboarding-system/static;
|
||
index index.html;
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
|
||
# API代理
|
||
location /api/ {
|
||
proxy_pass http://127.0.0.1:8080/api/;
|
||
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;
|
||
}
|
||
|
||
# WebSocket支持
|
||
location /ws/ {
|
||
proxy_pass http://127.0.0.1:8080/ws/;
|
||
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;
|
||
}
|
||
|
||
# 文件上传大小限制
|
||
client_max_body_size 100M;
|
||
|
||
# Gzip压缩
|
||
gzip on;
|
||
gzip_vary on;
|
||
gzip_min_length 1024;
|
||
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json;
|
||
}
|