您的位置:首页 > 运维架构 > Nginx

【NGINX】虚拟主机配置示例

2012-02-16 16:17 776 查看

虚拟主机标准配置

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;
     	}
     }
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: