> 服务器 >

nginx配置include管理多个配置文件

来源:网络 文章列表 2020-01-16 8
很多时候,我们配置Nginx的时候会分多个配置文件,每个项目单独一个配置文件。在window里,我们怎么引入多个配置文件呢? 比如我们有这么多个项目: 步骤一: 在conf目录下新建conf-

很多时候,我们配置Nginx的时候会分多个配置文件,每个项目单独一个配置文件。在window里,我们怎么引入多个配置文件呢?

比如我们有这么多个项目:

步骤一:

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

conf-test为你的Nginx的主配置目录。比如我的就是:E:\soft\nginx-1.13.6\conf

conf-test目录名可以随便取

test.conf的内容为

server {
	listen       8011;
	server_name  localhost;
 
	location / {
		root   html/web1;
		index  index.html index.htm;
	}
}
server {
	listen       8012;
	server_name  localhost;
 
	location / {
		root   html/web2;
		index  index.html index.htm;
	}
}
server {
	listen       8013;
	server_name  localhost;
 
	location / {
		root   html/web3;
		index  index.html index.htm;
	}
}

第二步:在nginx.conf中引入该配置文件  include conf-test/*.conf;

第三步:重启配置文件

 nginx -s reload

 

腾讯云限量秒杀

1核2G 5M 50元/年 2核4G 8M 74元/年 4核8G 5M 818元/年 CDN流量包 100GB 9元

版权声明

本站部分原创文章,部分文章整理自网络。如有转载的文章侵犯了您的版权,请联系站长删除处理。如果您有优质文章,欢迎发稿给我们!联系站长:
愿本站的内容能为您的学习、工作带来绵薄之力。

评论

  • 随机获取
点击刷新
精彩评论

友情链接