Virtual Host on Apache(Apache上建立虚拟主机)

王朝学院·作者佚名  2016-05-26
窄屏简体版  字體: |||超大  

Virtual Host on Apache(Apache上建立虚拟主机)0. Introduction

Usually, we want to build two or more websites on a web server, but we have only one ip and do not want to use ports (eg. www.abc.com:8081) to visit webpages.

So, how to make www.a.com and www.b.com both point to server X.X.X.X ?

1. Environment

Ubuntu 14.04 x64

BitnamiLAMP Stack 5.4.40

2. Steps

2.0. Configure "A" records of www.a.com and www.b.com to IP X.X.X.X

2.1. Make new dirs in .../apache2/htdocs for these two sites, such as, htdocsa and htdocsb

2.2. Modify .../apache2/conf/httpd.conf, add following codes:

NameVirtualHost X.X.X.X<VirtualHost X.X.X.X:80>ServerAdmin admin@a.comDocumentRoot /opt/lampstack-5.4.40-0/apache2/htdocs/htdocsaServerName www.a.com</VirtualHost>NameVirtualHost X.X.X.X<VirtualHost X.X.X.X:80>ServerAdmin admin@b.comDocumentRoot /opt/lampstack-5.4.40-0/apache2/htdocs/htdocsbServerName www.b.com</VirtualHost>

2.3. Restart apache

3. References

http://www.cnblogs.com/wpjsolo/archive/2012/01/19/2327457.html

http://www.xker.com/page/e2010/0925/98279.html

(This article is from http://www.cnblogs.com/chenyineng/p/4450978.html, and belongs to http://chenyineng.cnblogs.com and http://www.chenyineng.info)

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航