当前位置: > Linux服务器 > nginx >

【NGINX】虚拟主机配置示例

时间:2016-06-06 13:02来源:linux.it.net.cn 作者:IT


虚拟主机标准配置

 

 

http {
     server {
     	listen          80 default;
     	server_name     www.yourdomain.com;
     	access_log      logs/default.access.log main;
     	location / {
     		index index.html;
     		root  /var/www/default/htdocs;
     	}
     }
}

 

两个虚拟主机(纯静态html)

 

 

http {
     server {
     	listen          80;
     	server_name     www.domain1.com;
     	access_log      logs/domain1.access.log main;
     	location / {
     		index index.html;
     		root  /var/www/domain1.com/htdocs;
     	}
     }
     server {
     	listen          80;
     	server_name     www.domain2.com;
     	access_log      logs/domain2.access.log main;
     	location / {
     		index index.html;
     		root  /var/www/domain2.com/htdocs;
     	}
     }
}
(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容