【发布时间】:2015-08-08 03:07:33
【问题描述】:
我不是一个特别好的管理员,而是一个程序员。不过我现在需要配置这个 apache 网络服务器。
我有一个域 abc.sub.domain.com 和一个与该域匹配的 VHOST。但是 VHOST 也匹配 sub.domain.com,这应该只是指向 Apache 的默认页面,而不是在我的应用程序目录中。
这是我的会议
<VirtualHost *:80>
ServerName abc.sub.domain.com
</VirtualHost>
Include /path/to/local/config/httpd-vufind.conf
(开源)应用程序在环境变量上构建其整个配置,这就是我需要包含此 conf 文件的原因。无论域如何,该文件似乎总是包含在内。
现在,我想在域不完全匹配时禁用此包含。
然后,我想设置一个仅匹配 sub.domain.com 的默认 VHOST。在这个域上 phpMyadmin 和类似的工具应该可以工作。
这是我的默认 VHOST 的样子。在sites-anebled it's called000-default` 下,位于第一个位置。
<VirtualHost *:80>
ServerAdmin my@email.com
ServerName sub.domain.com
DocumentRoot /var/www
<Directory /var/www>
Options FollowSymLinks
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
但这无助于解决我的问题。 sub.domain.com 仍然被路由到第一个 VHOST 配置中(带有 include 语句)。如果域匹配,我如何才能包含 only?
【问题讨论】: