如何在本地配置多个站点?

时间:2014-01-01 21:34:38

标签: localhost wamp local

我已在我的机器上本地设置了wamp但我想在需要时在本地查看多个站点。

到目前为止,我已在hosts文件中输入以下代码

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost


127.0.0.1   mysitesname

我如何一次拥有多个网站?这可能吗?

1 个答案:

答案 0 :(得分:1)

配置name based virtual hosting,例如

# Only needed once.
NameVirtualHost *:80

# One section for each virtual host. Must
# match the "NameVirtualHost" directive.
<VirtualHost *:80>
    # The FQDN of the host.
    ServerName mysitesname

    # The file system path to the directory with
    # the files to serve by this virtual host.
    DocumentRoot /www/mysitesname
</VirtualHost>