Hi!
I'm going mad. Really. All the day working on apache but it still does not want to do its job ...
I have the following:
Apache/1.3.27 (Unix) Debian GNU/Linux
Kernel 2.4.18
/etc/apache/httpd.conf:
----- 8< -----
[...]
<Directory /var/www/vhosts>
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride All
</Directory>
UseCanonicalName Off
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteLog /var/log/apache/rewrite.log
RewriteLogLevel 1
RewriteCond %{SERVER_NAME} ^([^.]+)\.([^.]+)$ [NC]
RewriteRule ^(.*)$ /var/www/vhosts/%2/%1/htdocs$1
</IfModule>
NameVirtualHost *
<VirtualHost _default_:*>
ServerName foo.example.com
ServerAdmin webmaster DeleteThis @example.com
DocumentRoot /var/www/htdocs
ErrorLog /var/log/apache/error.log
CustomLog /var/log/apache/access.log full
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteOptions inherit
</IfModule>
</VirtualHost>
Include /etc/apache/vhosts.conf
[...]
----- >8 -----
/etc/apache/vhosts.conf:
----- 8< -----
[...]
<VirtualHost *>
ServerName example.net
ServerAlias *.example.net
ServerAdmin webmaster DeleteThis @example.net
DocumentRoot "/var/www/vhosts/net/example/htdocs"
VirtualDocumentRoot "/var/www/vhosts/%-1/%-2/%-3+/htdocs"
ErrorLog "/var/www/vhosts/net/example/error.log"
CustomLog "/var/www/vhosts/net/example/access.log" full
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteOptions inherit
</IfModule>
</VirtualHost>
[...]
----- >8 -----
When I try to access "http://www.example.net/" (yes, it's resolved correctly), I see the default page which lies in
/var/www/htdocs - and not the stuff from /var/www/vhosts/net/example/www/htdocs (as it should be).
Furthermore Apache writes the following into its /var/log/apache/error.log (that's true - the global error log, not the one I
defined in the VirtualHost container):
/var/log/apache/error.log:
----- 8< -----
[...]
No directory () for Hostname
www.example.net
No directory () for Hostname
www.example.net
No directory () for Hostname
www.example.net
No directory () for Hostname
www.example.net
No directory () for Hostname
www.example.net
No directory () for Hostname
www.example.net
[...]
----- >8 -----
Yes, six times. Strange?!
When I try to access "http://example.net/", I see the stuff which is in /var/www/vhosts/net/example/htdocs (as it should be) - but
it's logged in /var/log/apache/access.log ... and not in /var/www/vhosts/net/example/access.log (although I defined this in
vhosts.conf).
Now my questions:
- Why can't I access the subdomains of my virtual hosts?
- What does this strange error message "No directory () for Hostname
www.example.net" mean? I did not find anything on google ...
- Why is logging done into the global access.log and not into the file I defined in the VirtualHost container?
- Can anyone help me please?
Thank you in advance!
Bjoern