apache多域名绑定手记

用记事本打开appache下的httpd.conf文件
示例如下:

#号是起注释作用的
实例

代码:
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#

<VirtualHost *:80>
     DocumentRoot "D:\DATA\wwwroot\Apache" //绑定的网站目录

     ServerAdmin admin@www.hjxyw.com   //管理邮箱地址
     ServerName hjxyw.cn           //绑定的域名

     ErrorLog logs/dummy-host.example.com-error_log   //错误的日志
     CustomLog logs/dummy-host.example.com-access_log common //客户日志
     ErrorDocument 404 http://www.hjxyw.cn/404.html   //自定义出错页

</VirtualHost>

<VirtualHost *:80>
     DocumentRoot "D:\DATA\wwwroot\BBS"   (网站目录)
     ServerName BBS.hjxyw.cn     (虚拟主机)
     ErrorDocument 404 http://www.hjxyw.cn/404.html
</VirtualHost>


要绑定多少个域名,就添加多少个<VirtualHost></VirtualHost>记录
完毕!

posted on 2011-08-23 14:54  cn三少<script></script>  阅读(201)  评论(0编辑  收藏  举报

导航