Apache VHOSTS and separate logs

Discussion in 'Apache' started by ssa2204, Jun 5, 2007.

  1. #1
    I have been trying to set up Apache to log to individual files for each virtual host. Either I get Apache to run without separate logs, or Apache fails to load. I have tried just about everything, but nothing seems to work.

    With the config I have below, I am now able to get vhosts working, just not logging the way I want it. I get get to each website no problem. Problem may be that I was using both Yast to initially set up vhosts, while also reading the docs on Apache's site which confused me more. At the moment, the log file will be created, just no data is inserted. Everything is still going to var/log/apache2/access_log. The machine is OpenSuse 10.2

    Here is my config:
    apache2/conf.d/vhosts.conf
    <VirtualHost *:80>
    ServerAdmin webmaster@my-domain1.com
    DocumentRoot /srv/www/htdocs/
    ServerName www.my-domain1.com
    ServerAlias www.my-domain1.com
    ErrorLog /var/log/apache2/www.my-domain1.com-error_log
    CustomLog /var/log/apache2/www.my-domain1.com-access_log common
    </VirtualHost>

    <VirtualHost *:80>
    ServerAdmin webmaster@my-domain2.com
    DocumentRoot /srv/www/htdocs/my-domain2
    ServerName www.my-domain2.com
    ServerAlias www.my-domain2.com
    ErrorLog /var/log/apache2/www.my-domain2.com-error_log
    CustomLog /var/log/apache2/www.my-domain2.com-access_log common
    </VirtualHost>

    apache2/vhosts.d/vhosts.conf
    <VirtualHost www.my-domain1.com>
    DocumentRoot /srv/www/htdocs
    ServerName www.my-domain1.com
    ServerAdmin www.my-domain1.com
    <Directory /srv/www/htdocs>
    AllowOverride None
    Order allow,deny
    Allow from all
    DirectoryIndex index.php
    </Directory>
    ScriptAlias /cgi-bin/ /srv/www/cgi-bin
    <Directory /srv/www/cgi-bin>
    AllowOverride None
    Options +ExecCGI -Includes
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>

    <VirtualHost www.my-domain2.com>
    DocumentRoot /srv/www/htdocs/crm
    ServerName www.my-domain2.com
    ServerAdmin
     
    ssa2204, Jun 5, 2007 IP
  2. damonp

    damonp Peon

    Messages:
    97
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use one of these or the other but not both.

    apache2/vhosts.d/vhosts.conf
    apache2/conf.d/vhosts.conf

    If you are getting an error, please post error message.
     
    damonp, Jun 6, 2007 IP