EC2 virtualmin DocumentRoot troubles - pls hlp

21 posts / 0 new
Last post
#1 Tue, 09/16/2008 - 10:01
walter

EC2 virtualmin DocumentRoot troubles - pls hlp

I am having a similar issue, each virtual server I have setup routes to /var/www/html/index.html (i created the index.html file to confirm it loads from this location) instead of the respective directory like /home/myusername/public_html/

The httpd.conf for a user's virtual host looks like this:

<VirtualHost xx.xx.xx.xx:80> SuexecUserGroup "#502" "#503" ServerName myusername.net ServerAlias www.myusername.net ServerAlias webmail.myusername.net ServerAlias admin.myusername.net DocumentRoot /home/myusername/public_html ErrorLog /home/myusername/logs/error_log CustomLog /home/myusername/logs/access_log combined ScriptAlias /cgi-bin/ /home/myusername/cgi-bin/ ScriptAlias /awstats /home/myusername/cgi-bin DirectoryIndex index.html index.htm index.php index.php4 index.php5 <Directory /home/myusername/public_html> Options Indexes IncludesNOEXEC FollowSymLinks allow from all AllowOverride All </Directory> <Directory /home/myusername/cgi-bin> allow from all </Directory> RewriteEngine on RewriteCond %{HTTP_HOST} =webmail.myusername.net RewriteRule ^(.) https://myusername.net:20000/ [R] RewriteCond %{HTTP_HOST} =admin.myusername.net RewriteRule ^(.) https://myusername.net:10000/ [R] Alias /dav /home/myusername/public_html <Location /dav> DAV On AuthType Basic AuthName myusername.net AuthUserFile /home/myusername/etc/dav.digest.passwd Require valid-user ForceType text/plain Satisfy All </Location> <Files awstats.pl> AuthName "myusername.net statistics" AuthType Basic AuthUserFile /home/myusername/.awstats-htpasswd require valid-user </Files> </VirtualHost>

Operating system CentOS Linux 5 Webmin version 1.430 Virtualmin version 3.61.gpl (GPL) Theme version 6.1 Kernel and CPU Linux 2.6.16-xenU on i686

I must be missing something obvious, appreciate any help.

TIA - Walter

Tue, 09/16/2008 - 11:02
andreychek

Hi Walter,

Just so that I understand what you're saying --

Are you saying that you have the above VirtualHost setup for &quot;www.myusername.net&quot;, with a website in &quot;/home/myusername/public_html&quot;.

But upon going to &quot;www.myusername.net&quot;, rather than seeing the content in /home/myusername/public_html, you're being given content within /var/www/html/index.html?

Does that sound like what's happening?

Thanks,
-Eric

Sat, 12/20/2008 - 10:57 (Reply to #2)
javaguy78

The dos characters are due to me copying the config files and zipping them on a windows xp machine. My server is running on Ubuntu Hardy. I'll give it a try and reply.

Sun, 06/07/2009 - 07:43 (Reply to #3)
dkcp

I'm having the same problem and it's driving me nuts!

New installation of Ubuntu 8.04 Server with Virtualmin (through install.sh). It's behind a firewall but everything else works.

All of my virtual servers serves www through /var/www

<b>config for default</b>
[code:1]NameVirtualHost 192.168.237.99:80
NameVirtualHost 194.218.3.10:80

&lt;VirtualHost *&gt;
ServerAdmin webmaster@localhost

DocumentRoot /var/www/
&lt;Directory /&gt;
Options FollowSymLinks
AllowOverride None
&lt;/Directory&gt;
&lt;Directory /var/www/&gt;
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
&lt;/Directory&gt;

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
&lt;Directory &quot;/usr/lib/cgi-bin&quot;&gt;
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
&lt;/Directory&gt;

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On

Alias /doc/ &quot;/usr/share/doc/&quot;
&lt;Directory &quot;/usr/share/doc/&quot;&gt;
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
&lt;/Directory&gt;

&lt;/VirtualHost&gt;
[/code:1]

<b>Virtual Server Conf</b>
[code:1]&lt;VirtualHost 194.218.3.10:80&gt;
SuexecUserGroup &quot;#1001&quot; &quot;#1002&quot;
ServerName twoheadedboy.org
ServerAlias www.twoheadedboy.org webmail.twoheadedboy.org admin.twoheadedboy.org lists.twoheadedboy.org
DocumentRoot /home/twoheadedboy/public_html
ErrorLog /var/log/virtualmin/twoheadedboy.org_error_log
CustomLog /var/log/virtualmin/twoheadedboy.org_access_log combined
ScriptAlias /cgi-bin/ /home/twoheadedboy/cgi-bin/
ScriptAlias /awstats /home/twoheadedboy/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
&lt;Directory /home/twoheadedboy/public_html&gt;
Options -Indexes IncludesNOEXEC FollowSymLinks
allow from all
AllowOverride All
&lt;/Directory&gt;
&lt;Directory /home/twoheadedboy/cgi-bin&gt;
allow from all
&lt;/Directory&gt;
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.twoheadedboy.org
RewriteRule ^(.*) https://twoheadedboy.org:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.twoheadedboy.org
RewriteRule ^(.*) https://twoheadedboy.org:10000/ [R]
Alias /dav /home/twoheadedboy/public_html
Alias /pipermail /var/lib/mailman/archives/public
&lt;Location /dav&gt;
DAV On
AuthType Basic
AuthName twoheadedboy.org
AuthUserFile /home/twoheadedboy/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
&lt;/Location&gt;
&lt;Files awstats.pl&gt;
AuthName &quot;twoheadedboy.org statistics&quot;
AuthType Basic
AuthUserFile /home/twoheadedboy/.awstats-htpasswd
require valid-user
&lt;/Files&gt;
RedirectMatch /cgi-bin/mailman/([^/]*)(.*) https://twoheadedboy.org:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
RedirectMatch /mailman/([^/]*)(.*) https://twoheadedboy.org:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
&lt;/VirtualHost&gt;
[/code:1]

This is how they look default. I've tried a few variations but no luck so far.

Any ideas? Thanks.

Sun, 06/07/2009 - 07:43 (Reply to #4)
dkcp

I'm having the same problem and it's driving me nuts!

New installation of Ubuntu 8.04 Server with Virtualmin (through install.sh). It's behind a firewall but everything else works.

All of my virtual servers serves www through /var/www

<b>config for default</b>
[code:1]NameVirtualHost 192.168.237.99:80
NameVirtualHost 194.218.3.10:80

&lt;VirtualHost *&gt;
ServerAdmin webmaster@localhost

DocumentRoot /var/www/
&lt;Directory /&gt;
Options FollowSymLinks
AllowOverride None
&lt;/Directory&gt;
&lt;Directory /var/www/&gt;
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
&lt;/Directory&gt;

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
&lt;Directory &quot;/usr/lib/cgi-bin&quot;&gt;
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
&lt;/Directory&gt;

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On

Alias /doc/ &quot;/usr/share/doc/&quot;
&lt;Directory &quot;/usr/share/doc/&quot;&gt;
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
&lt;/Directory&gt;

&lt;/VirtualHost&gt;
[/code:1]

<b>Virtual Server Conf</b>
[code:1]&lt;VirtualHost 194.218.3.10:80&gt;
SuexecUserGroup &quot;#1001&quot; &quot;#1002&quot;
ServerName twoheadedboy.org
ServerAlias www.twoheadedboy.org webmail.twoheadedboy.org admin.twoheadedboy.org lists.twoheadedboy.org
DocumentRoot /home/twoheadedboy/public_html
ErrorLog /var/log/virtualmin/twoheadedboy.org_error_log
CustomLog /var/log/virtualmin/twoheadedboy.org_access_log combined
ScriptAlias /cgi-bin/ /home/twoheadedboy/cgi-bin/
ScriptAlias /awstats /home/twoheadedboy/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
&lt;Directory /home/twoheadedboy/public_html&gt;
Options -Indexes IncludesNOEXEC FollowSymLinks
allow from all
AllowOverride All
&lt;/Directory&gt;
&lt;Directory /home/twoheadedboy/cgi-bin&gt;
allow from all
&lt;/Directory&gt;
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.twoheadedboy.org
RewriteRule ^(.*) https://twoheadedboy.org:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.twoheadedboy.org
RewriteRule ^(.*) https://twoheadedboy.org:10000/ [R]
Alias /dav /home/twoheadedboy/public_html
Alias /pipermail /var/lib/mailman/archives/public
&lt;Location /dav&gt;
DAV On
AuthType Basic
AuthName twoheadedboy.org
AuthUserFile /home/twoheadedboy/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
&lt;/Location&gt;
&lt;Files awstats.pl&gt;
AuthName &quot;twoheadedboy.org statistics&quot;
AuthType Basic
AuthUserFile /home/twoheadedboy/.awstats-htpasswd
require valid-user
&lt;/Files&gt;
RedirectMatch /cgi-bin/mailman/([^/]*)(.*) https://twoheadedboy.org:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
RedirectMatch /mailman/([^/]*)(.*) https://twoheadedboy.org:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
&lt;/VirtualHost&gt;
[/code:1]

This is how they look default. I've tried a few variations but no luck so far.

Any ideas? Thanks.

Tue, 09/16/2008 - 11:08
walter

Yes, exactly.

Tue, 09/16/2008 - 11:38 (Reply to #6)
andreychek

Out of curiosity, does going to:

http://webmail.myusername.net

Correctly redirect to Usermin on port 20000?
-Eric

Tue, 09/16/2008 - 11:44
walter

Eric,

It also goes to: /var/www/html/index.html

Walter

Tue, 09/16/2008 - 12:14 (Reply to #8)
andreychek

Fascinating :-)

If you restart Apache, do any errors show up in the main Apache log?

Also, does &quot;NameVirtualHost&quot; exist in your httpd.conf? And if so, does the IP/port after it match what's listed in the VirtualHost definition:

&lt;VirtualHost xx.xx.xx.xx:80&gt;

For example, you should have something like:

NameVirtualHost 1.2.3.4:80

Followed by:

&lt;VirtualHost 1.2.3.4:80&gt;
...
&lt;/VirtualHost&gt;

Tue, 09/16/2008 - 12:33
walter

Eric,

Restart Apache produced this error:

httpd: Could not reliably determine the server's fully qualified domain name, using ec2-xx-xx-xx-xx.compute-1.amazonaws.com for ServerName

[Tue Sep 16 04:02:21 2008] [warn] NameVirtualHost 10.250.15.128:80 has no VirtualHosts

The IP address of the NameVirtualHost is the internal IP address. There is also NameVirtualHost xx.xx.xx.xx:80 that is the correct IP address that matches the VirtualHost IP address.

I could PM you the webmin login, is there PM on this forum, i don't see it?

Walter

Tue, 09/16/2008 - 16:43 (Reply to #10)
andreychek

Hey Walter,

Yeah, would you mind if I poked around?

You can email login details to eric@virtualmin.com, the forum doesn't support PM's so far as I know ;-)

Thanks!
-Eric

Wed, 11/05/2008 - 07:53 (Reply to #11)
nextgi

Hi, I am having the same issue, is there a quick fix?

Wed, 12/17/2008 - 08:54
javaguy78

I am trying to get virtualmin to work on my server and am having the same problem. It seems to be using the directives from

&lt;VirtualHost *&gt;

for all virtual domains rather than loading the configuration for that domain stored in

&lt;VirtualHost xxx.xxx.xxx.xxx:80&gt;

Is this a problem with Apache2 or Virtualmin? if it is a problem with Apache2, how do we fix it. I tried to remove &lt;VirtualHost *&gt;, but that only afforded me 404 errors.

Wed, 12/17/2008 - 09:27 (Reply to #13)
andreychek

Crap, you'd think once I got it working for walter that I'd post the fix here, but no, and now I've forgotten what I did :-)

I believe what needs to happen though is that every VirtualHost line should be xxx.xxx.xxx.xxx:80 as you mentioned, but that there needs to be a matching &quot;NameVirtualHost&quot; above the first VirtualHost... something like:

NameVirtualHost xxx.xxx.xxx.xxx:80

Right now, that line likely exists, but with a &quot;*&quot; in it... just replace that * with the IP address and port.
-Eric

Wed, 12/17/2008 - 09:40
javaguy78

Hmm.. I replaced the Moved the

NameVirtualHost *

to the end of the NameVirtualHost list, that didn't work. I renamed it to

NameVirtualHost xxx.xxx.xxx.xxx:80

That didn't work. So I renamed it to

NameVirtualHost 127.0.0.1:80

and that gave me 404 errors. It still seems that all my virtual hosts are using this set of directives rather than their own

NameVirtualHost xxx.xxx.xxx.xxx:80

set of directives. &lt;shrug&gt;&amp;nbsp;&lt;/shrug&gt;

Wed, 12/17/2008 - 09:43 (Reply to #15)
andreychek

Hrm, would you be willing to post your httpd.conf file? If you're reluctant to do that (which is understandable), would you consider emailing it to me? You can email it to eric@virtualmin.com -- be sure to include a link to this post somewhere in the message body. Thanks!
-Eric

Wed, 12/17/2008 - 09:58
javaguy78

I'm a long time webmin user, so I thought I'd give virtualmin a try to host my sites. I don't mind posting my conf files since the server is just a sandbox right now.

I don't have an httpd.conf, the files attached are from the following locations:

/etc/apache2/apache2.conf
/etc/apache2/sites-available/default
/etc/apache2/sites-available/server.themaskedcrusader.com.conf

Thank you for your help. [file name=conf.zip size=5562]http://www.virtualmin.com/components/com_fireboard/uploaded/files/conf.z...

Wed, 12/17/2008 - 16:13 (Reply to #17)
andreychek

Alright, so, here's what I'd do.

In the file &quot;default&quot;, delete the line &quot;NameVirtualHost 127.0.0.1:80&quot;, and put your IP address in for the line &quot;&lt;VirtualHost 127.0.0.1:80&gt;&quot; in place of 127.0.0.1.

Then, restart Apache with:

/etc/init.d/apache2 restart

When you do so -- do you get any messages on the command line? Anything unusual in /var/log/apache2/error_log?

And if not, does that work -- and if not, what symptom are you seeing now?

Also, there's some odd character endings in those config files. I'm hoping it's simply related to attaching it here, but they all have MS-DOS style characters at the end. If we get stuck, I may recommend running dos2unix on them, but I wouldn't worry about that quite yet :-)
-Eric

Wed, 12/24/2008 - 03:16
javaguy78

So, here's the deal. It appears that Ubuntu Hardy has a problem with it's Apache2 config. I just installed Virtualmin gpl (via the install.sh script) on Centos 5.2 and everything works wonderfully. Weird...

So, the fix seems to be this: Run virtualmin on an Enterprise Grade linux OS!

thank you to those who helped!

Wed, 12/24/2008 - 20:07 (Reply to #19)
andreychek

Well, I'm definitely glad it's working.

Some folks here swear by CentOS, so you're definitely in good hands.

I happen to be using Ubuntu personally, but if you got it working with Cent, well, that's great :-)
-Eric

Fri, 02/27/2009 - 10:06
dkcp

I cracked it. Needed to change the server settings so that all virtualhosts use the internal IP and change the &lt;VirtualHost *&gt; directive to match internal IP:PORT.

Topic locked