版权声明:禁止CV操作 https://blog.csdn.net/H44341466/article/details/86550417
今天再本地测试项目,新配置了一个nginx的upstream,但是不生效:
开始配置如下:
upstream mServer{
server localhost:6000;
server localhost:6001;
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
这样配置是不生效的;
需要加上下面这些:
upstream mServer{
server localhost:6000;
server localhost:6001;
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
proxy_pass http://mServer;
proxy_set_header Host $host;
index index.html index.htm;
}
需要加上这两行做一个代理设置就ok了