You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Phillip Jones <pj...@gmail.com> on 2009/10/20 19:07:33 UTC

[users@httpd] location match order

Hi,
I asked about this awhile ago but did not receive a response. My end
goal is to run trac (http://trac.edgewall.org/) at the server root,
while still having other static content or web apps on subdirectories.

http://www.example.com/
should display trac

http://www.example.com/static
should display static content

As an intermediate step, I setup trac in its own subdirectory (using
<Location /trac> )
http://www.example.com/trac
and it works fine, as do the other subdirectories.

However, once I modify the config files so that trac uses <Location
/>, then any other address is passed directly to the trac handler. For
example, http://www.example.com/static shows the trac page with an
error stating "no handler matched request /static/" It appears that
the location directive '/' is matched before the alias '/static' so
everything after the slash is merely passed to the trac handler.

Is it possible to do this? If so, how do I configure Apache for this?
My current config file is below.
thanks for any suggestions,
Phillip

<IfModule mod_ssl.c>
<VirtualHost *:443 >
	ServerName intranet.example.com
	ServerAdmin pjones@example.com
	
	Alias /static /var/www/
	<Directory /var/www/>
		allow from all
	</Directory>

	DocumentRoot /home/tracroot/htdocs
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>

	<Directory /home/tracroot/htdocs/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ErrorLog /var/log/apache2/error.log
	LogLevel warn

	CustomLog /var/log/apache2/ssl_access.log combined

	SSLEngine on
	SSLCertificateFile    /etc/ca/intranet.example.com.cert.pem
	SSLCertificateKeyFile /etc/ca/intranet.example.com.key.pem

	BrowserMatch ".*MSIE.*" \
		nokeepalive ssl-unclean-shutdown \
		downgrade-1.0 force-response-1.0
	
	<Location />
		AuthType Basic
		AuthName "intranet: Enter your username and password"
		AuthUserFile /etc/subversion-htpasswd
		Require valid-user

		SetHandler mod_python
		PythonHandler trac.web.modpython_frontend
		PythonInterpreter main
		PythonOption TracEnv /home/tracroot
		PythonOption TracUriRoot /
		SetEnv PYTHON_EGG_CACHE /tmp
	</Location>

	<Location "/login">
		AuthType Basic
		AuthName "intranet: Enter your username and password"
		AuthUserFile /etc/subversion-htpasswd
		Require valid-user
	</Location>

</VirtualHost>
</IfModule>

---------------------------------------------------------------------
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


Re: [users@httpd] location match order

Posted by Phillip Jones <pj...@gmail.com>.
> I expect a RemoveHandler in a <Location /static/> at the
> bottom of your config might help, if I understand the question
> aright.
>

many thanks Nick!
I knew there had to be a way to get this done, I just didn't know what it was.

Since my <Location /> uses SetHandler mod_python, I first tried
"RemoveHandler mod_python" but that did not work. Instead,

<Location /static/>
  SetHandler None
</Location>

seems to do the trick. Hopefully someone will let me know if there's a
reason I shouldn't do it this way.
-Phillip

---------------------------------------------------------------------
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


Re: [users@httpd] location match order

Posted by Nick Kew <ni...@webthing.com>.
Phillip Jones wrote:
> Hi,
> I asked about this awhile ago but did not receive a response. My end
> goal is to run trac (http://trac.edgewall.org/) at the server root,
> while still having other static content or web apps on subdirectories.
> 
> http://www.example.com/
> should display trac
> 
> http://www.example.com/static
> should display static content

I don't see the latter anywhere in your configuration.
Only some <Directory> stuff, which <Location /> will override
because it takes the configuration right out of your filesystem
and into URL-space.

I expect a RemoveHandler in a <Location /static/> at the
bottom of your config might help, if I understand the question
aright.

-- 
Nick Kew

---------------------------------------------------------------------
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