nginx反向代理配置

1、在 conf/nginx.conf 中,很多都是默认配置,笔者把注释去掉,添加了自己少量的配置

worker_processes 1;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;

server {
listen 8888; # 任意
server_name localhost;

location / {
root html;
index index.html index.htm;
}

# 新加的
location /spring {
proxy_pass http://120.79.197.130:8530; # 后端接口 IP:port
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

}

}

原文地址:https://www.cnblogs.com/tomofagain/p/11022234.html