在apache服务器中如何建立多个网站,并且绑定不同的目录呢?
其实是非常简单的事情在服务器中找到httpd.conf,这个是apache的配置文件。SourceByrd's Weblog-https://note.t4x.org/basic/apache-config-virtualhost/
假设我的域名www.selmy.org我绑定的目录是/var/www/docs/selmys/SourceByrd's Weblog-https://note.t4x.org/basic/apache-config-virtualhost/
查找:httpd.conf
0 |
[root@Byrd www]# find / -name httpd.conf |
然后编辑httpd.conf,增加如下内容:
0 1 2 3 4 5 6 |
<VirtualHost *:80> ServerAdmin webmaster@t4x.org DocumentRoot /var/www/docs/selmy.org ServerName www.selmy.org ErrorLog logs/www.selmy.org_log CustomLog logs/selmy.org-access_log common </VirtualHost> |
我的另外一个网站假设是www.baidu.comSourceByrd's Weblog-https://note.t4x.org/basic/apache-config-virtualhost/
那么
0 1 2 3 4 5 6 |
<VirtualHost *:80> ServerAdmin webmaster@baidu.com DocumentRoot /var/www/docs/badiu.com ServerName www.baidu.com ErrorLog logs/www.baidu.com_log CustomLog logs/badiu.com-access_log common </VirtualHost> |
申明:转载于网络,版权归原作者所有!SourceByrd's Weblog-https://note.t4x.org/basic/apache-config-virtualhost/ SourceByrd's Weblog-https://note.t4x.org/basic/apache-config-virtualhost/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!