69 lines
2.0 KiB
Nginx Configuration File
69 lines
2.0 KiB
Nginx Configuration File
worker_processes 1;
|
||
|
||
events {
|
||
worker_connections 1024;
|
||
}
|
||
|
||
http {
|
||
include mime.types;
|
||
default_type application/octet-stream;
|
||
sendfile on;
|
||
keepalive_timeout 65;
|
||
|
||
server {
|
||
listen 80;
|
||
server_name localhost;
|
||
|
||
# WVP 后端 API 代理(优先匹配)
|
||
location /api/ {
|
||
proxy_set_header Host $http_host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header REMOTE-HOST $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_pass http://wvp-pro:18978;
|
||
}
|
||
|
||
# 后端静态资源代理(快照图片等,来自后端服务)
|
||
location /snap/ {
|
||
proxy_pass http://wvp-pro:18978;
|
||
proxy_set_header Host $http_host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
}
|
||
|
||
# WebSocket 代理支持
|
||
location /ws/ {
|
||
proxy_pass http://wvp-pro:18978;
|
||
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;
|
||
}
|
||
|
||
# 前端静态资源(CSS、JS、图片等)
|
||
location /static/ {
|
||
root /home/ruoyi/projects/wvp-ui;
|
||
expires 30d;
|
||
access_log off;
|
||
}
|
||
|
||
# 前端页面(最后匹配)
|
||
location / {
|
||
root /home/ruoyi/projects/wvp-ui;
|
||
try_files $uri $uri/ /index.html;
|
||
index index.html index.htm;
|
||
}
|
||
|
||
# 避免actuator暴露
|
||
if ($uri ~ "/actuator") {
|
||
return 403;
|
||
}
|
||
|
||
error_page 500 502 503 504 /50x.html;
|
||
location = /50x.html {
|
||
root html;
|
||
}
|
||
}
|
||
} |