Override default setting in Apache <VirtualHost> block by default

In the default Apache2 configuration, Debian /etc/apache2/sites-enabled/000-defaultcontains many settings for VirtualHost by default:

<VirtualHost *:80>
    # Many good settings here, among them:
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
</VirtualHost>

In another configuration file, I would like to override one of them, the option CustomLogso that the logs go somewhere else. I do not want to copy, or to communicate with all the other settings, for example ScriptAlias. But I still want this to apply to <VirtualHost *:80>.

Is it possible?

What i tried

I tried to put this in /etc/apache2/sites-enabled/001-mylog:

<VirtualHost *:80>
    CustomLog ${APACHE_LOG_DIR}/my.log combined
</VirtualHost>

This has no effect, presumably because apache only looks at the first partition <VirtualHost>, and /etc/apache2/sites-enabled/000-defaultloads to /etc/apache2/sites-enabled/001-mylog.

/etc/apache2/conf.d/mylog, /etc/apache2/sites-enabled/000-default, /etc/apache2/apache2.conf Include conf.d/ Include sites-enabled/. CustomLog, . ScriptAlias /etc/apache2/sites-enabled/000-default .

, /etc/apache2/sites-enabled/000-default Debian Apache .

Apache HTTP Server - :

,   IP- . . IP , "" .

IP- , . , , IP-. , IP- IP .

<VirtualHost> <Directory>

, , <VirtualHost> . , , <Directory>, /, :

<Directory "/some/dir">
        Options Indexes MultiViews FollowSymLinks
</Directory>
<Directory "/some/dir">
        AllowOverride None
        Order deny,allow
        Allow from all
</Directory>

:

<Directory "/some/dir">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Allow from all
</Directory>

<VirtualHost> :-(

: , , VirtualHost Debian . , , .

+7

All Articles