Virtual Domains point to /var/www

I’ve verified both in webmin and in /etc/apache/httpd.conf that in each virtual server declaration the /home/$USER/public_html directive is there.

Ideas? Something else in the httpd.conf?

Hi Danny,

Can you be more specific about where you’re seeing domains point to /var/www? Is it in the Virtualmin-generated httpd.conf directives, or are you seeing some evidence in the error.log that Apache is trying to find files there?

When I visit the site with a host entry in my hosts file on my windows machine it points the site the /var/www on the server. It does to all domains on the machine.

< VirtualHost 000.000.000.000:80]
ServerName thedanman.org
ServerAlias www.thedanman.org
DocumentRoot /home/thedanman/public_html
ErrorLog /home/thedanman/logs/error_log
CustomLog /home/thedanman/logs/access_log common
ScriptAlias /cgi-bin/ /home/thedanman/cgi-bin/
< Directory /home/thedanman/public_html]
Options Indexes IncludesNOEXEC FollowSymLinks
allow from all
< /Directory]
< /VirtualHost]

The brackets do not have spaces in the file itself.

There is a sample from the httpd.conf file. All domains follow that same directive. However when visiting with a browser apache is still pointing the domains to /var/www.

Sample from error.log

[[Tue Sep 13 08:28:37 2005]] [[error]] [[client 216.148.212.188]] File does not exist: /var/www/modules/rss/rss.php
[[Tue Sep 13 08:35:37 2005]] [[error]] [[client 195.204.19.152]] File does not exist: /var/www/coppermine/thumbnails.php
[[Tue Sep 13 08:35:38 2005]] [[error]] [[client 195.204.19.152]] File does not exist: /var/www/favicon.ico
[[Tue Sep 13 08:38:11 2005]] [[error]] [[client 128.118.50.16]] File does not exist: /var/www/favicon.ico
[[Tue Sep 13 08:39:17 2005]] [[error]] [[client 207.46.98.68]] File does not exist: /var/www/robots.txt
[[Tue Sep 13 08:39:17 2005]] [[error]] [[client 207.46.98.68]] File does not exist: /var/www/cont.html
[[Tue Sep 13 08:41:05 2005]] [[error]] [[client 207.46.98.68]] File does not exist: /var/www/link.html

Oh! Apache isn’t configured for name-based virtual hosting.

Add the following line to httpd.conf before any VirtualHost entries:

NameVirtualHost x.x.x.x:80

Where x.x.x.x is the address where your name-based hosts will live. You can also do this with the Webmin Apache module. Click on Networking and Addresses and find the field labeled "Addresses for name virtual servers". Enter your.I.P.address:80

Save it. Apply changes. You’re done!

Thanks!

Okay, heh, I added the appropriate entries, now when I visit the site, images do not render in the browser. Gives 404 if I try to go to them directly. The images are in a folder under public_html. I think perhaps apache isn’t recognizing anything deeper than public_html. I may come up with a fix, just barely started scratching my head on it.

[[Tue Sep 13 12:06:01 2005]] [[error]] [[client 69.53.127.218]] File does not exist: /usr/share/images/galleryorig.jpg
[[Tue Sep 13 12:06:01 2005]] [[error]] [[client 69.53.127.218]] File does not exist: /usr/share/images/newbar.gif

Straight from the error logs. Very curious. I’ll think it through on the way home.

Resolved!

#< IfModule mod_alias.c>

Alias /icons/ /usr/share/apache/icons/

[ Directory /usr/share/apache/icons>

Options Indexes MultiViews

AllowOverride None

Order allow,deny

Allow from all

[ /Directory>

Alias /images/ /usr/share/images/

[ Directory /usr/share/images>

Options MultiViews

AllowOverride None

Order allow,deny

Allow from all

[ /Directory]

#< /IfModule]

That did the trick. Now maybe someone will google one day and find this ;-D.

Be very careful about sharing directories on your Linux system. It may compromise your server. You should never run anything under root that is exposed to the net (www). These are words of wisdom regardless if it is a shared directory on your server.

Thanks, and I realize that. I didn’t put that in there myself. I believe when I installed apache from the Ubuntu it was added in there by the dpkg.