最新消息:发现真没时间折腾VPS,最近又换了个空间。呵呵

Apache虚拟主机的添加

在以前的Apache里,虚拟主机的配置是加在Apache安装目录下的conf/httpd.conf中的。现在的新版本加了一个extra目录,虚拟主机的配置可以写在conf/extra/httpd-vhosts.conf里,也可以像以前一样,写到conf/httpd.conf里。

如果是写到conf/extra/httpd-vhosts.conf里,要在conf/httpd.conf里确认一下Include "conf/extra/httpd-vhosts.conf"没有被注释,如果是注释的,需要把注释放开。然后在httpd-vhosts.conf里,把NameVirtualHost *:80的注释打开,再按照httpd-vhosts.conf的例子,配置虚拟主机,如下代码:

Apache
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<virtualHost *:80>
    ##ServerAdmin postmaster@dummy-host.localhost
    DocumentRoot "/Tool/Server/studio/test"
    ServerName test.com
    ServerAlias www.test.com
    ##ErrorLog "logs/dummy-host.localhost-error.log"
    ##CustomLog "logs/dummy-host.localhost-access.log" combined
</virtualHost>

转载请注明:宇托的狗窝 » Apache虚拟主机的添加

发表我的评论
取消评论

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址