nginx config的多個config配置


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;
    }
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM