nginx 多個網站配置


iis時此時有多個網站,nginx.conf兩種配置方式

第一種:直接配置在nginx.conf中

在nginx.conf中新增配置

http節點下新增:

upstream weba{ 
		server 39.xxx.xxx.xxx:8032; 
	}
upstream webb{ 
		server 39.xxx.xxx.xxx:8033; 
	}

 

server {
        listen       10171;
        server_name  localhost;
        location / {
		     proxy_pass http://weba;
        }
    }
server {
        listen       10172;
        server_name  localhost;
        location / {
		     proxy_pass http://webb;
        }
    }

第二種新增配置文件:

新建cuswebconf文件夾,並在此文件夾中新增文件weba.conf、webb.conf

weba.conf

upstream weba{  
		server 39.xxx.xxx.xxx:8032 weight=1;
	}
    server {
        listen       10171;
        server_name  localhost;
        location / {
			proxy_pass http://weba;
        }
    }

webb.conf

upstream webb{  
		server 39.xxx.xxx.xxx:8032 weight=1;
	}
    server {
        listen       10172;
        server_name  localhost;
        location / {
			proxy_pass http://webb;
        }
    }

nginx.conf文件中http節點新增

include  cuswebconf/*.conf;

 

 


免責聲明!

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



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