nginx config的多个config配置
1、在nginx主配置文件nginx.conf的http模块下引入配置文件夹
http {
    include /usr/local/nginx/conf/conf.d/*.conf;
    #这里就是引入的子配置文件夹
    }
2、在引入的配置文件夹中添加配置文件*.conf
upstream tomcat {
    server 127.0.0.1:8081;   #服务器地址1
    server 127.0.0.1:8082;   #服务器地址2
}
server {
    listen       8080;
    server_name  localhost;

    location / {
        root   html;
        index  index.html index.htm;
        proxy_pass http://127.0.0.1:8081/admin/; #配置反向代理地址
        #proxy_pass http://tomcat; #多代理配置
    }
    location /admin/ {
        root   html;
        index  index.html index.htm;
        proxy_pass http://127.0.0.1:8081/admin/; #配置反向代理地址
        #proxy_pass http://192.168.2.60:8080/; #配置反向代理地址
    }

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

相关文章:

  • 2021-05-28
  • 2021-08-08
  • 2021-10-03
  • 2021-07-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-22
  • 2022-02-03
  • 2022-12-23
  • 2021-04-16
相关资源
相似解决方案