-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:前端项目使用nginx服务代理,不在使用后端服务代理 (#100)
* fix:前端项目使用nginx服务代理,不在使用后端服务代理 * fix:修改备注
- Loading branch information
1 parent
7767353
commit 5b79b0c
Showing
4 changed files
with
71 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
#! /bin/bash | ||
|
||
# 启动nginx | ||
nginx -g 'daemon on;' | ||
# 启动后端服务 | ||
cd /xiaoju-survey/server | ||
npm run start:prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# 启动的 worker 进程数量 | ||
worker_processes auto; | ||
|
||
# 错误日志路径和级别 | ||
error_log /var/log/nginx/error.log warn; | ||
|
||
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; | ||
keepalive_timeout 65; | ||
server { | ||
listen 8080; | ||
# IPv6端口 | ||
listen [::]:8080; | ||
server_name localhost; | ||
# gzip config | ||
gzip on; | ||
gzip_min_length 1k; | ||
gzip_comp_level 9; | ||
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml; | ||
gzip_vary on; | ||
gzip_disable "MSIE [1-6]\."; | ||
root /xiaoju-survey/web/dist; | ||
|
||
location / { | ||
try_files $uri $uri /management.html; | ||
} | ||
|
||
location /management/ { | ||
try_files $uri $uri/ /management.html; | ||
} | ||
|
||
location /render/ { | ||
try_files $uri $uri/ /render.html; | ||
} | ||
|
||
location /api { | ||
proxy_pass http://127.0.0.1:3000; | ||
} | ||
|
||
error_page 500 502 503 504 /500.html; | ||
client_max_body_size 20M; | ||
} | ||
|
||
} |