Bonehead question on ServerAlias

16 posts / 0 new
Last post
#1 Sat, 07/11/2009 - 01:16
tbirnseth

Bonehead question on ServerAlias

I have a DNS entry for helpdesk.test.ez-ms.com that is an A record and it resolves to the correct address (same address as ezupgrade.test.ez-ms.com)

I have a VirtualHost setup with a ServerName of ezupgrade.test.ez-ms.com.

I thought I could just add a ServerAlias helpdesk.test.ez-ms.com to the above ServerName/VirtualHost and it would serve the requests for helpdesk.test.ez-ms.com.

However, when I do curl helpdesk.test.ez-ms.com I get Unknown HTTP_HOST (helpdesk.test.ez-ms.com). returned from httpd.

a curl ezupgrade.test.ez-ms.com returns the correct result for running index.php with no parameters.

What am I missing? I have restarted httpd and named but it doesn't seem to want to find index.php in the ServerName's home directory when addressed via helpdesk.test.ez-ms.com.

I'm sure I'm overlooking something simple! But sure can't see it.

Sat, 07/11/2009 - 06:11
andreychek

Hmmm, any chance you could post the related VirtualHost config section from your Apache config?

Thanks!

-Eric

Sat, 07/11/2009 - 11:35
tbirnseth

sure, here ya go

</VirtualHost>
<VirtualHost 192.168.101.2:80>
SuexecUserGroup "#506" "#507"
ServerName ezupgrade.test.ez-ms.com
ServerAlias www.ezupgrade.test.ez-ms.com
ServerAlias helpdesk.test.ez-ms.com
ServerAlias www.helpdesk.test.ez-ms.com
ServerAlias webmail.ezupgrade.test.ez-ms.com
ServerAlias admin.ezupgrade.test.ez-ms.com
ServerAlias lists.ezupgrade.test.ez-ms.com
DocumentRoot /home/ezupgrade/public_html
ErrorLog "|/etc/webmin/virtual-server/writelogs.pl 12435805188690 /home/ezupgrade/logs/error_log"
CustomLog "|/etc/webmin/virtual-server/writelogs.pl 12435805188690 /home/ezupgrade/logs/access_log" combined
ScriptAlias /cgi-bin/ /home/ezupgrade/cgi-bin/
ScriptAlias /awstats /home/ezupgrade/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/ezupgrade/public_html>
Options -Indexes IncludesNOEXEC FollowSymLinks ExecCGI
allow from all
AllowOverride All
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/ezupgrade/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/ezupgrade/fcgi-bin/php5.fcgi .php5
AddType application/x-httpd-ruby .rb
AddType application/x-httpd-ruby .rbx
Action application/x-httpd-ruby /cgi-bin/ruby.cgi
</Directory>
<Directory /home/ezupgrade/cgi-bin>
allow from all
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.ezupgrade.test.ez-ms.com
RewriteRule ^(.*) https://ezupgrade.test.ez-ms.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.ezupgrade.test.ez-ms.com
RewriteRule ^(.*) https://ezupgrade.test.ez-ms.com:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
IPCCommTimeout 3600
<Files awstats.pl>
AuthName "ezupgrade.test.ez-ms.com statistics"
AuthType Basic
AuthUserFile /home/ezupgrade/.awstats-htpasswd
require valid-user
</Files>
PerlRequire /etc/webmin/virtualmin-google-analytics/apachemod.pl
PerlOutputFilterHandler Virtualmin::GoogleAnalytics
Alias /dav /home/ezupgrade/public_html
Alias /pipermail /var/lib/mailman/archives/public
<Location /dav>
DAV On
AuthType Basic
AuthName ezupgrade.test.ez-ms.com
AuthUserFile /home/ezupgrade/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
RemoveHandler .php
RemoveHandler .php5
</Location>
RedirectMatch /cgi-bin/mailman/([^/]*)(.*) https://ezupgrade.test.ez-ms.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
RedirectMatch /mailman/([^/]*)(.*) https://ezupgrade.test.ez-ms.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
<Location /svn>
DAV svn
SVNParentPath /home/ezupgrade/svn
AuthType Basic
AuthName ezupgrade.test.ez-ms.com
AuthUserFile /home/ezupgrade/etc/svn.basic.passwd
Require valid-user
AuthzSVNAccessFile /home/ezupgrade/etc/svn-access.conf
Satisfy Any
</Location>
</VirtualHost>
Sat, 07/11/2009 - 22:28
andreychek

Hrm, is that really how it looks, or is the forum here just mangling it? :-)

You might want to try putting that in at something like http://pastie.org/ , and just linking the page it gives you here... thanks!

-Eric

Sun, 07/12/2009 - 12:30
tbirnseth

That is a cut/paste from my httpd.conf.

What do you see? That's how VM set it up for a domain of ezupgrade.test.ez-ms.com with a couple of added aliases that are in my template.

What is pastie.org? Guess I'll have to check it out if there are no answers here.

tony

Sun, 07/12/2009 - 17:25
andreychek

Pastie is a site that allows you to copy and paste "stuff" into it for others to see.

What I see in your paste above is a bunch of HTML tags, which I think this software inadvertently added. I doubt Apache wouldn't even start with the code I see in it above :-)

So my thoughts are either:

  1. Try pasting that into pastie.org

  2. Try adding your config as an attachment to your post here

Thanks!

-Eric

Mon, 07/13/2009 - 00:25
tbirnseth

Really, the code window with the VirtualServer block looks fine from here... What 'config' are you referring to for me to attach?

I don't want to have to create a separate server for this and then fiddle with the UID/GID stuff so I can get both to be served from the same directory.

If you can't read what's posted, is there a different method/manner in which I can get it to you?

tony

Mon, 07/13/2009 - 12:50
clwheatley

Actually, there is a problem with the virtualhost's conf file, at least as it is displayed here. You have HTML code in there, which should not be the case.

Take for instance lines 5-8. You have

ServerAlias <a href="http://www.ezupgrade.test.ez-ms.com ServerAlias" title="www.ezupgrade.test.ez-ms.com ServerAlias">www.ezupgrade.test.ez-ms.com ServerAlias</a> helpdesk.test.ez-ms.com

See the link there (a href... /a)? Later on you also have italic "em" tags. You do not want any mark up in your conf file. If those truly are in your conf file (i.e. not here because of a something related to your cut and paste) then you will want to remove it.

Blessings!

Chris

Mon, 07/13/2009 - 13:12
tbirnseth

Well, not sure how those got in this cut/paste. They are not in the httpd.conf I've re-pasted it again. Hopefully it will come in literally.

tony

</VirtualHost>
<VirtualHost 192.168.101.2:80>
SuexecUserGroup "#506" "#507"
ServerName ezupgrade.test.ez-ms.com
ServerAlias www.ezupgrade.test.ez-ms.com
ServerAlias helpdesk.test.ez-ms.com
ServerAlias www.helpdesk.test.ez-ms.com
ServerAlias webmail.ezupgrade.test.ez-ms.com
ServerAlias admin.ezupgrade.test.ez-ms.com
ServerAlias lists.ezupgrade.test.ez-ms.com
DocumentRoot /home/ezupgrade/public_html
ErrorLog "|/etc/webmin/virtual-server/writelogs.pl 12435805188690 /home/ezupgrade/logs/error_log"
CustomLog "|/etc/webmin/virtual-server/writelogs.pl 12435805188690 /home/ezupgrade/logs/access_log" combined
ScriptAlias /cgi-bin/ /home/ezupgrade/cgi-bin/
ScriptAlias /awstats /home/ezupgrade/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/ezupgrade/public_html>
Options -Indexes IncludesNOEXEC FollowSymLinks ExecCGI
allow from all
AllowOverride All
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/ezupgrade/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/ezupgrade/fcgi-bin/php5.fcgi .php5
AddType application/x-httpd-ruby .rb
AddType application/x-httpd-ruby .rbx
Action application/x-httpd-ruby /cgi-bin/ruby.cgi
</Directory>
<Directory /home/ezupgrade/cgi-bin>
allow from all
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.rc1.test.ez-ms.com
RewriteRule ^(.*) https://rc1.test.ez-ms.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.rc1.test.ez-ms.com
RewriteRule ^(.*) https://rc1.test.ez-ms.com:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
<Files awstats.pl>
AuthName "rc1.test.ez-ms.com statistics"
AuthType Basic
AuthUserFile /home/rc1/.awstats-htpasswd
require valid-user
</Files>
PerlRequire /etc/webmin/virtualmin-google-analytics/apachemod.pl
PerlOutputFilterHandler Virtualmin::GoogleAnalytics
Alias /dav /home/rc1/public_html
Alias /pipermail /var/lib/mailman/archives/public
<Location /dav>
DAV On
AuthType Basic
AuthName rc1.test.ez-ms.com
AuthUserFile /home/rc1/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
RemoveHandler .php
RemoveHandler .php5
</Location>
RedirectMatch /cgi-bin/mailman/([^/]*)(.*) https://rc1.test.ez-ms.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
RedirectMatch /mailman/([^/]*)(.*) https://rc1.test.ez-ms.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
<Location /svn>
DAV svn
SVNParentPath /home/rc1/svn
AuthType Basic
AuthName rc1.test.ez-ms.com
AuthUserFile /home/rc1/etc/svn.basic.passwd
Require valid-user
AuthzSVNAccessFile /home/rc1/etc/svn-access.conf
Satisfy Any
</Location>
</VirtualHost>
Mon, 07/13/2009 - 13:18
tbirnseth

It's the forum sw. Apparently it's converting the www.domain.com type names to hyperlinks even inside code tags. It's also translating '*' chars as emphasis tags. So I guess someone will just have to interpet or I can email it to someone who can help.

I'm trying to post it within html tags here. [html] SuexecUserGroup "#506" "#507" ServerName ezupgrade.test.ez-ms.com ServerAlias www.ezupgrade.test.ez-ms.com ServerAlias helpdesk.test.ez-ms.com ServerAlias www.helpdesk.test.ez-ms.com ServerAlias webmail.ezupgrade.test.ez-ms.com ServerAlias admin.ezupgrade.test.ez-ms.com ServerAlias lists.ezupgrade.test.ez-ms.com DocumentRoot /home/ezupgrade/public_html ErrorLog "|/etc/webmin/virtual-server/writelogs.pl 12435805188690 /home/ezupgrade/logs/error_log" CustomLog "|/etc/webmin/virtual-server/writelogs.pl 12435805188690 /home/ezupgrade/logs/access_log" combined ScriptAlias /cgi-bin/ /home/ezupgrade/cgi-bin/ ScriptAlias /awstats /home/ezupgrade/cgi-bin DirectoryIndex index.html index.htm index.php index.php4 index.php5 Options -Indexes IncludesNOEXEC FollowSymLinks ExecCGI allow from all AllowOverride All AddHandler fcgid-script .php AddHandler fcgid-script .php5 FCGIWrapper /home/ezupgrade/fcgi-bin/php5.fcgi .php FCGIWrapper /home/ezupgrade/fcgi-bin/php5.fcgi .php5 AddType application/x-httpd-ruby .rb AddType application/x-httpd-ruby .rbx Action application/x-httpd-ruby /cgi-bin/ruby.cgi allow from all RewriteEngine on RewriteCond %{HTTP_HOST} =webmail.ezupgrade.test.ez-ms.com RewriteRule ^(.) https://ezupgrade.test.ez-ms.com:20000/ [R] RewriteCond %{HTTP_HOST} =admin.ezupgrade.test.ez-ms.com RewriteRule ^(.) https://ezupgrade.test.ez-ms.com:10000/ [R] RemoveHandler .php RemoveHandler .php5 IPCCommTimeout 3600 AuthName "ezupgrade.test.ez-ms.com statistics" AuthType Basic AuthUserFile /home/ezupgrade/.awstats-htpasswd require valid-user PerlRequire /etc/webmin/virtualmin-google-analytics/apachemod.pl PerlOutputFilterHandler Virtualmin::GoogleAnalytics Alias /dav /home/ezupgrade/public_html Alias /pipermail /var/lib/mailman/archives/public DAV On AuthType Basic AuthName ezupgrade.test.ez-ms.com AuthUserFile /home/ezupgrade/etc/dav.digest.passwd Require valid-user ForceType text/plain Satisfy All RemoveHandler .php RemoveHandler .php5 RedirectMatch /cgi-bin/mailman/([^/])(.) https://ezupgrade.test.ez-ms.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2 RedirectMatch /mailman/([^/])(.) https://ezupgrade.test.ez-ms.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2 DAV svn SVNParentPath /home/ezupgrade/svn AuthType Basic AuthName ezupgrade.test.ez-ms.com AuthUserFile /home/ezupgrade/etc/svn.basic.passwd Require valid-user AuthzSVNAccessFile /home/ezupgrade/etc/svn-access.conf Satisfy Any [/html]

Mon, 07/13/2009 - 13:19
tbirnseth

Well, that didn't work either so not sure how to get the info our here!

Mon, 07/13/2009 - 13:21
tbirnseth

Suffice to say the only thing I added to this VirtualServer config is a line of: ServerAlias helpdesk.test.ez-ms.com

after the line regarding the www ServerAlias for the ServerName.

But when I try to access helpdesk.test.ez-ms.com via curl I get the HTTP Host not found message.

Mon, 07/13/2009 - 13:44
andreychek

Well, I'm not sure what I said in my post above is clicking :-)

Yes, the forum software here is messing up your post by adding weird stuff to it... and the two simplest ways to fix it so that we can see it are:

  1. Attach your config as a text file to the post (so rather than copying and pasting it, you're attaching it as a file)

  2. Go to pastie.org, paste your config file in there, then just follow up here in the forums with a link to the pastie.org URL they give you that contains your config file. Their site won't mess it up the way this one will :-)

Mon, 07/13/2009 - 14:50
tbirnseth

Okay, I give up. Tried to attach a *.txt file and get: An HTTP error 0 occurred. /comment-upload/js

I don't really want to go sign up for yet another site just to post information. I had hoped it would be obvious to someone or someone could tell me what needs to be done additionally to simply add a ServerAlias other than to add the alias name to the directive.

Mon, 07/13/2009 - 16:17
tbirnseth

Okay, I figured it out and see my error.

The ServerAlias really needs to be in the test.ez-ms.com VirtualServer and then use a RewriteCond/RewriteRule to redirect it to ezupgrade.test.ez-ms.com.

Having it within the ezupgrade.test.ez-ms.com VirtualServer definition simply won't resolve it correctly.

Tue, 07/14/2009 - 14:26
andreychek

I'm glad you figured it out!

For future reference though (as this comes in handy for many things), pastie.org does not require an account of any sort.

Anyone can anonymously post to it. I'm like you, I don't like signing up for stuff :-)

I find it incredibly valuable for online discussions (for the forums here, IRC, IM conversations, and the like). Just a heads up. Have a good one!

-Eric

Topic locked