win nginx 用include管理多个配置文件,如部署多个web前端程序 配置host域名访问

当要部署多个web程序时,先将web程序分文件夹到html,

 

1 在conf目录下新建conf-test/test_web.conf

内容为:

server {
	listen       80;
	server_name  webone.com;
 
	location / {
		root   html/web1;
		index  index.html index.htm;
	}
}
server {
	listen       80;
	server_name  webtwo.com;
 
	location / {
		root   html/web2;
		index  index.html index.htm;
	}
}
server {
	listen       80;
	server_name  webthree.com;
 
	location / {
		root   html/web3;
		index  index.html index.htm;
	}
}

 

2 在nginx.conf中引入该配置文件 include conf-test/*.conf;

 

 

4 找到hosts文件, C:\Windows\System32\drivers\etc

增加

127.0.0.1 webone.com
127.0.0.1 webtwo.com
127.0.0.1 webthree.com

posted @ 2023-07-20 10:45  Tozhang  阅读(546)  评论(0编辑  收藏  举报