Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to set up an alias in my httpd.conf file so that I can look at my log files via my browser. The following is the alias that I am trying to create.

Alias /logs "/<servername>/log"
<Directory /<servername>/log>
  Options Indexes FollowSymLinks
  AuthName "Application Logs"
  AuthType Basic
  AuthUserFile /<servername>/ihs/610/conf/.htpasswd
  <Limit GET POST>
     require valid-user
  </Limit>
</Directory>

This works OK on my developer box but not on my production box. The differnce is that on my production box, my application is installed with a context root of /. When I type in my URL and add the alias (e.g. mysite.com/logs), instead of seeing the log directory, I am seeing my custom 404 error page.

I think this is because I am not using a context root or just / for my application and all requests will be delayed by the application.

Is there any workaround?

share|improve this question
    
Are you sure that mod_alias is installed? –  sledge May 8 '09 at 13:28

3 Answers 3

Presumably your "application" is some sort of Django/PHP/Perl something-or-other that does all of the URL handling itself, right? Depending on how that's configured, you may need to move this configuration to earlier in the config file, or if your application is set up using RewriteRules, add an exception to allow this prefix to pass through without triggering your application.

share|improve this answer

If I understand correctly, you're using a separate piece of httpd.conf or a .htaccess to route URLs to your applicaton... something like this:

RewriteRule ^(.*)$ /index.php?route=$1

You should be able to either add a .htaccess file into your log directory and turn off the rewriting, or add

RewriteCond %{REQUEST_URI} !^/logs
RewriteRule ... as above...
share|improve this answer

Something like this should work:

you should put , not some kind of :) It should be like "/home/httpd/www/logs/" or "/var/log/apache/log/".

And it is better to finish directories with "/". It may be important in some configurations.

Alias /logs/ "/<path to your directory>/log/"
<Directory /<path to your directory>/log/>
  Options Indexes FollowSymLinks
  AuthName "Application Logs"
  AuthType Basic
  AuthUserFile /<path to your directory>/ihs/610/conf/.htpasswd
  <Limit GET POST>
     require valid-user
  </Limit>
</Directory>
share|improve this answer
    
Oh this totally works on at least a WAMP set up. –  random Sep 11 '09 at 15:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.