FireFoxII
FireFoxII

Reputation: 828

Set apache log folder

I have a home server with debian as S.O. and apache/php7 installed

Like web hosting have error.log on root folder, I want a similar solution for each website that I have on my /www folder instead of single file that for default is "var/log/apache2/error.log"

I'm trying to working on htaccess adding this line

RewriteEngine On RewriteLog "path/to/error.log" RewriteLogLevel 9

but not working...

Upvotes: 0

Views: 55

Answers (1)

spinsch
spinsch

Reputation: 1415

You can't put a RewriteLog directive in an .htaccess. This is available in the server config or virtual host config only.

example for vhost:

/etc/apache2/sites-available/yoursite.com.conf

<VirtualHost *:80>
  <IfModule mod_rewrite.c>
    RewriteLog /var/log/apache2/rewrite.log
    RewriteLogLevel 9
  </IfModule>
  ServerName yoursite.com
  DocumentRoot /var/www/yoursite/html
  <Directory "/var/www/yoursite/html">
      <IfModule mod_rewrite.c>
        RewriteEngine On
      </IfModule>
  </Directory>
</VirtualHost>

example for all sites on your server (global):

create file like /etc/apache2/conf-available/debug.conf

add your configuration here:

<IfModule mod_rewrite.c>
  RewriteLog /var/log/apache2/rewrite.log
  RewriteLogLevel 9
</IfModule>

enable the config:

sudo a2enconf debug ; sudo service apache2 reload

disable the config:

sudo a2disconf debug ; sudo service apache2 reload

Upvotes: 1

Related Questions