有什么办法可以改变Apache VirtualHosts首先加载的顺序吗?

Jak*_*era 19 apache apache2

我正在使用通配符子域来管理我的大部分请求,但是我遇到了一个问题,即首先加载我的子域名(例如,wiki.domain.com).

我知道在httpd.conf或其他内容中加载这个只是假设VirtualHosts首先加载,但我使用a2ensite和sites-available来管理我的域(每个域的单个文件),据我所知,意味着我没有真正的方法来确定哪些域首先被"加载".

我正在运行Ubuntu Hardy.

Rob*_*rco 30

I believe the order of loading is from the name of the configuration file in the /etc/apache2/sites-enabled directory. so if you wanted one loaded first, you would name the file 000-wiki.domain.com (or a2ensite 000-wiki.domain.com)

Out of curiosity, why does the order matter for you?

  • 该顺序很重要,因为第一个Vhost配置具有最高优先级,并且是在其他人的名称无法匹配时使用的配置:http://httpd.apache.org/docs/2.2/vhosts/examples.html (22认同)

Mee*_*com 29

要检查当前加载的virtualHosts(及其加载顺序):

httpd -S
Run Code Online (Sandbox Code Playgroud)

在Ubuntu OS上,您还可以使用以下内容:

apache2ctl -S
Run Code Online (Sandbox Code Playgroud)