开发者社区> 问答> 正文

【NGINX】虚拟主机配置示例 虚拟主机标准配置 两个虚拟主机(纯静态html) :报错

虚拟主机标准配置

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;
     	}
     }
}





原文链接: http://blog.csdn.net/feng88724/article/details/7265022

展开
收起
kun坤 2020-06-20 11:27:59 1076 0
1 条回答
写回答
取消 提交回答
  • 果然够清楚,,简单明了!

    2020-06-20 11:28:05
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
天猫HTML5互动技术实践 立即下载
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载