OT:Apache question

Rick Stevens rstevens at vitalstream.com
Fri Feb 20 21:06:34 UTC 2004


Mark Knecht wrote:
> Rick Stevens wrote:
> 
>> Why not get into your apache config file and do something like this:
> 
> 
> Rick - I still get the Alert box nonsense with www.knechthome.com in it. 
> I think this is the real issue. Why does Apache look at my hosts file 
> and choose to use this info?

Did you hit http://www.knechthome.com/files?  That's how the alias
works.

> 
> OK, so the first question that came up was which apache config file? I 
> find two directories
> 
> /etc/apache/conf
> /etc/apache2/conf/
> 
> The second has an apache2.conf file in which I placed your edits at the 
> end:

Oops!  No, those have to be either before the first "<VirtualHost>
</VirtualHost>" clause (to make it server-wide, if you have more than
one VirtualHost) or inside the clause (to make it active for JUST this
VirtualHost).  For example:

GLOBAL:
	Alias /files "/mnt/data/sessions"

	<Directory "/mnt/data/sessions">
	    Options Indexes FollowSymlinks MultiViews
	    AllowOverride None
	    Order allow,deny
	    Allow from all
	</Directory>

	<VirtualHost www.knechthome.com>    (or <VirtualHost *>)
	    ServerAdmin webmaster at knechthome.com	(Varies)
	    ServerName www.knechthome.com		(Varies)
	    DocumentRoot /your/document/root		(Varies)
	    ScriptAlias /cgi-bin/ "/your/cgi-bin/"	(Varies)
	    ErrorLog logs/knechthome.error_log		(Varies)
	    CustomLog logs/knechthome.access_log common	(Varies)
	</VirtualHost>

VIRTUAL HOST-SPECIFIC:
	<VirtualHost www.knechthome.com>    (or <VirtualHost *>)
	    Alias /files "/mnt/data/sessions"

	    <Directory "/mnt/data/sessions">
		Options Indexes FollowSymlinks MultiViews
		AllowOverride None
		Order allow,deny
		Allow from all
	    </Directory>
	    ServerAdmin webmaster at knechthome.com	(Varies)
	    ServerName www.knechthome.com		(Varies)
	    DocumentRoot /your/document/root		(Varies)
	    ScriptAlias /cgi-bin/ "/your/cgi-bin/"	(Varies)
	    ErrorLog logs/knechthome.error_log		(Varies)
	    CustomLog logs/knechthome.access_log common	(Varies)
	</VirtualHost>

You choose.  My guess is you have a single site (a "<VirtualHost *>"),
so I'd put them in the GLOBAL section.  Note also that the "(Varies)"
is telling you in this message that the data in those lines will no
doubt be different than what I'm showing.

> Is this the right file?

If you're using Apache 2.x, yes.

>> Stop and restart Apache after changing the file.  
> 
> 
> Did this. /var/log/apache2/error_log shows the restart.

Ok, so you're using Apache 2.x (must be the native install for RH9).

> /var/log/apache2/access_log shows me going to the top page 
> (marksmusic.myvnc.com)
> 
> 63.146.68.30 - - [20/Feb/2004:11:02:39 -0800] "GET / HTTP/1.1" 304 - "-" 
> "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040217"
> 
> 
> Aiming your browser
> 
>> at "http://www.your.site/files" will result in an index listing of the
>> "/directory/where/the/files/are" directory.
> 
> 
> However, when I try to access the files page it shows it failing with a 
> 301 error I think.
> 
> 301 == "Moved Permanently"?

I think you'll find that moving your set up will stop that from 
happening.  Remember that "Alias" sets up a quasi-symlink (like doing
an "ln -s") to something that's not in your "DocumentRoot" directory
tree.  The "<Directory>" stuff actually controls the access to the
alias' destination (like "chmod" would to the destination of a symlink).

You still must make sure that Apache can read the directory by doing
the chmod stuff.  Apache is running as "nobody" and can't override
filesystem permissions.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-                      LOOK OUT!!! BEHIND YOU!!!                     -
----------------------------------------------------------------------





More information about the Redhat-install-list mailing list