Score:0

Apache httpd: Alias is inherited by virtual host?

tm flag

When the default server contains

Alias /bla /srv/www/blub

then all VirtualHosts can also acecss /bla.

I must say I didn't anticipate that. IMO a virtual server should have its own separate config.

Is that a bug or a feature? Can I switch this behavior off?

Score:1
ar flag
bob

Settings not limited to a specific VirtualHost but placed in the main server configuration files (i.e. the httpd.conf or in configuration snippets loaded with Include and/or IncludeOptional directives) are valid for the whole server and that includes any and all VirtualHosts.

That is by design:

Scope: Directives placed in the main configuration files apply to the entire server. If you wish to change the configuration for only a part of the server, you can scope your directives by placing them in <Directory>, <DirectoryMatch>, <Files>, <FilesMatch>, <Location>, and <LocationMatch> sections. These sections limit the application of the directives which they enclose to particular filesystem locations or URLs. They can also be nested, allowing for very fine grained configuration.

httpd has the capability to serve many different websites simultaneously. This is called Virtual Hosting. Directives can also be scoped by placing them inside <VirtualHost> sections, so that they will only apply to requests for a particular website.

Do not place directives in the main httpd.conf that you do not want to apply to all VirtualHosts.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.