更新 nginx.conf
This commit is contained in:
13
nginx.conf
13
nginx.conf
@ -9,19 +9,25 @@ http {
|
||||
keepalive_timeout 65;
|
||||
|
||||
upstream node_app {
|
||||
server 127.0.0.1:3001;
|
||||
server 127.0.0.1:3001; # Node.js 后端端口
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
# 静态文件
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
root /usr/share/nginx/html;
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
|
||||
location /api {
|
||||
location /public/ {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
# 后端 API
|
||||
location /api/ {
|
||||
proxy_pass http://node_app;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
@ -30,3 +36,4 @@ http {
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user