Apache 2.4 / Windows Server 2016-设置多个网站

时间:2019-02-13 22:16:49

标签: apache vhosts windows-server-2016

我正在Windows 2016 Server上运行Apache 2.4 / 64bit。我没有安装服务器或安装Apache……网络公司做了。 (我要求使用Linux,但我被喊了)。

无论如何,我在conf文件中设置了一个虚拟主机,但是不管我做什么,我似乎都无法从它的DocumentRoot加载该站点。即使是我添加的虚拟主机,它也只会加载默认网站。

这是我的httpd-vhosts.conf:

# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# 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 webmaster@dummy-host.example.com
    DocumentRoot "${SRVROOT}/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error.log"
    CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "${SRVROOT}/docs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin me@mydomain.org
    DocumentRoot "${SRVROOT}/htdocs/xmldef"
    ServerName xmldef.ntts.local
    ErrorLog "logs/xmldef-error.log"
    CustomLog "logs/xmldef-access.log" common
</VirtualHost>

有人可以告诉我我所缺少的吗?我做了谷歌,但找不到与此问题有关的任何东西...

谢谢。

0 个答案:

没有答案