修改的文件和字段
文件是 niginx.conf 文件
字段是 server 字段中的 路径下的 proxy_pass 字段
server {
# nginx监听所有127.0.0.1:80端口收到的请求
listen 80;
server_name 127.0.0.1;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
# 127.0.0.1:80 会被转发到这里
# 同时, 前端程序会接收到 "127.0.0.1:8000"这样的请求url
location / {
proxy_pass http://127.0.0.1:8000;
}
# 127.0.0.1:80/api/ 会被转发到这里
# 同时, 后端程序会接收到 "127.0.0.1:9000/api/"这样的请求url
location /api/ {
proxy_pass http://127.0.0.1:9000;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}