httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khamis Siksek <kha...@freesoft.jo>
Subject [users@httpd] Wierd behaviors
Date Thu, 25 Sep 2003 23:10:07 GMT
Dear all,

I had a strange behavior from Apache that i don't know if it is a bug or
a
mis-configuration, and i hope that i find someone who is patient enough
to
read this email, has a solution for this problem, or says that this is a
bug
and should be escalated to the apache developers.

You need mainly three things here:
1- To configure the DNS
2- To configure apache
3- (optional) configure auth_pam_module (you can remove the
authentication
part from the configuration file)

I configured Apache (version 2.0.46) on RedHat 9.0 to support virtual
hosting, and here is a snapshot of my configuration file


--------- Starts Here --------
.
.
. 
#
# Load config files from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf
.
.
.
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
.
.
.
#
ServerName www.mydomain.com:80
UseCanonicalName Off
DocumentRoot "/var/www/html"
.
.
.
<Directory "/home/*/website">
	AllowOverride None
	<FilesMatch "\.(pl|cgi|reg|php)$">
	 	deny from all
	</FilesMatch>
</Directory>
<Directory "/home/*/website/cgi-bin">
	AllowOverride None
	Options None
	<FilesMatch "\.(pl|cgi|reg|php)$">
	 	allow from all
	</FilesMatch>
</Directory>
<Directory "/home/*/website/cpanel">
	AllowOverride All
	AuthPAM_Enabled on
	AuthType "Basic"
	AuthName "Restricted Access"

	<FilesMatch "\.(pl|cgi|reg|php)$">
	 	allow from all
	</FilesMatch>
</Directory>
.
.
.
DirectoryIndex index.htm index.html index.html.var index.php
.
.
.
#
# AccessFileName: The name of the file to look for in each directory
# for access control information.  See also the AllowOverride directive.
#
AccessFileName .htaccess

#ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
.
.
.
#
NameVirtualHost 192.168.0.1:80

<VirtualHost 192.168.0.1>
	DocumentRoot /var/www/html/website
        ServerAdmin  admin@mydomain.com
        ServerName   mydomain.com
		<Directory />
		    Options FollowSymLinks
		    AllowOverride None
		</Directory>

        ServerSignature email
</VirtualHost>

<VirtualHost 192.168.0.1>
	DocumentRoot /var/www/html/website
        ServerAdmin  admin@mydomain.com
        ServerName   www.mydomain.com
	<Directory />
	    Options FollowSymLinks 
	    AllowOverride None
	</Directory>
        ServerSignature email
</VirtualHost>

<VirtualHost 192.168.0.1>
	DocumentRoot /var/www/html/website
        ServerAdmin  admin@mydomain.com
        ServerName   new.mydomain.com
	<Directory />
	    Options FollowSymLinks 
	    AllowOverride None
	</Directory>
        ServerSignature email
</VirtualHost>

<VirtualHost 192.168.0.1>
        DocumentRoot /var/www/html/horde
        ServerAdmin  admin@mydomain.com
        ServerName   mail.mydomain.com
		<Directory />
		    Options FollowSymLinks
		    AllowOverride None
		</Directory>

        ServerSignature email
</VirtualHost>
--------- Ends Here ----------

The idea of the site is to give each user his own domain so if i have a
user called
jodeth, she will have her own website on jodeth.mydomain.com, we only
add for her
a corresponding DNS entry, and password entry (we use auth_pam_module
for authentication)
and a corresponding VirtualHost as the following

--------- Starts Here --------
<VirtualHost 192.168.0.1>
        DocumentRoot /home/jodeth/website
        ServerAdmin  admin@mydomain.com
        ServerName   jodeth.mydomain.com
	.
	.
	.
        ServerSignature email
</VirtualHost>
--------- Ends Here ----------

ISSUE NUMBER 1:
That works fine for us, but a problem occurred, when the number of users
increased over 4000 user (i don't remember the specific number), the
server started to refuse starting up (without giving an error message),
it seems that there is a limitation on the number of VirtualHosts that
can be used, i searched the net but i did't find anyone mentioning this
limitation

So we thought of something else, i made some research on Apache and the
solution
was in the Dynamic VirtualHost, and by that the number of VirtualHost
entries reduced
from thousands to 5 main VirtualHost entries (the main four
above-mentioned) and this
one (Just a note i use an include file called mydomain.conf and as you
can see the
include files are included first thing in httpd.conf file i have from
RedHat 9.0)

--------- Starts Here --------
<VirtualHost 192.168.0.1:80>
        VirtualDocumentRoot /home/%1/website
        ServerAdmin administrator@mydomain.com
        VirtualScriptAlias /home/%1/website/cgi-bin

        ServerSignature email
</VirtualHost>
--------- Ends Here ----------

ISSUE NUMBER 2:
Another problem happened which is i needed to comment the ScriptAlias in
the main file
for my VirtualScriptAlias to work (I think that there should be some
precedence, 
so if not found in the VirtualScriptAlias to look into the ScriptAlias)

Since i don't need anything from the main ScriptAlias i didn't have a
problem in commenting it out

ISSUE NUMBER 3:
When i added the VirtualHost entry in the included file i had to put the
port number
(e.g. VirtualHost 192.168.0.1:80) unlike the VirtualHost i defined in
the main httpd.conf file.

ISSUE NUMBER 4:
The most strange behavior i saw, was when i started the apache server,
everything works
fine, when i give it mail.mydomain.com (or any of the main VirtualHost)
i can browse it
and when i use one of the defined DynamicVirtualHost (e.g.
khamis.mydomain.com) it also
works fine. Now the strange behavior was after several restarts the main
ones are not
available (the Dynamically defined ones are ok), you need to restart the
server several times so they are available again.

I looked into the log files and i found this error message:
[Tue Sep 23 07:07:00 2003] [error] [client 213.186.191.66] File does not
exist: /home/mail

As you can see in the Dynamic VirtualHost settings i refer to /home, so
apache assumed that
mail.mydomain.com is another user and tried to fetch the website from
the Dynamic VirtualHost
instead of using the Static VirtualHost defined in the httpd.conf file,
there should be
some precedence for the statically defined VirtualHost over the
dynamically defined
VirtualHost in such case (or give a priority option in the configuration
to solve this problem)

The last wierd issue is
ISSUE NUMBER 5:
After using dynamic VirtualHost, some of the users couldn't access thier
own index.html
and instead they go to index.html of the main site which reside in
/var/www/html/website
i had to touch the index.html (i.e. touch index.html) files in thier own
home directories
for them to appear. I verified that it nothing to do with the time,
since there are other
users who have thier index.html works fine.

I know that this is maybe the longest email you ever had, but i tried my
best to explain the problems i faced and i didn't find any refernce for
them on the net, sorry if i made you uncomfortable or bored, and
Thanks for your patience and cooperation and i will be pleased to
receive emails from you asking for more details, or giving me a link
that can help.

Best regards to all of you,
	Khamis Siksek


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message