LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache + Alias directories returning 404 (http://www.linuxquestions.org/questions/linux-server-73/apache-alias-directories-returning-404-a-672750/)

Tamber-Krain 09-27-2008 11:32 AM

Apache + Alias directories returning 404
 
(I've banged my head against this problem for a coupla weeks now, and I'm finally admitting I'm stumped by it...)

I'm running Apache 2 (not sure which exact version, but I'm trying to get that now.) on my Gentoo server, and after a brief period of it being so badly misconfigured that it wouldn't serve documents at all, I have it working again.

Except for the Aliased directories, which I just get a 404 on each time I try to go to them.

My httpd.conf file is below:
Code:

LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
<IfDefine CACHE>
LoadModule cache_module modules/mod_cache.so
</IfDefine>
LoadModule cgid_module modules/mod_cgid.so
<IfDefine DAV>
LoadModule dav_module modules/mod_dav.so
</IfDefine>
<IfDefine DAV>
LoadModule dav_fs_module modules/mod_dav_fs.so
</IfDefine>
<IfDefine DAV>
LoadModule dav_lock_module modules/mod_dav_lock.so
</IfDefine>
LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
<IfDefine CACHE>
LoadModule disk_cache_module modules/mod_disk_cache.so
</IfDefine>
LoadModule env_module modules/mod_env.so
LoadModule expires_module modules/mod_expires.so
LoadModule ext_filter_module modules/mod_ext_filter.so
<IfDefine CACHE>
LoadModule file_cache_module modules/mod_file_cache.so
</IfDefine>
LoadModule filter_module modules/mod_filter.so
LoadModule headers_module modules/mod_headers.so
LoadModule include_module modules/mod_include.so
<IfDefine INFO>
LoadModule info_module modules/mod_info.so
</IfDefine>
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
<IfDefine CACHE>
LoadModule mem_cache_module modules/mod_mem_cache.so
</IfDefine>
LoadModule mime_module modules/mod_mime.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule speling_module modules/mod_speling.so
<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so
</IfDefine>
<IfDefine STATUS>
LoadModule status_module modules/mod_status.so
</IfDefine>
LoadModule unique_id_module modules/mod_unique_id.so
<IfDefine USERDIR>
LoadModule userdir_module modules/mod_userdir.so
</IfDefine>
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so

# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
User apache
Group apache

################################################

ServerName djavul.localhost
ServerAdmin webmaster@localhost
Listen 80 
################################################

# Supplemental configuration
#
# Most of the configuration files in the /etc/apache2/modules.d/ directory can
# be turned on using APACHE2_OPTS in /etc/conf.d/apache2 to add extra features
# or to modify the default configuration of the server.
#
# To know which flag to add to APACHE2_OPTS, look at the first line of the
# the file, which will usually be an <IfDefine OPTION> where OPTION is the
# flag to use.
Include /etc/apache2/modules.d/*.conf


################################################################################

DocumentRoot /var/www/localhost/htdocs
<Directory "/var/www/localhost/htdocs">
  Options Indexes MultiViews
  Order allow,deny
  Allow from all
</Directory>

 <IfModule mpm_peruser_module>
                ServerEnvironment apache apache
        </IfModule>
        <IfModule mod_alias>
        #Icons!
          Alias /icons/ "/var/www/localhost/icons"       
          Alias /error/ "/var/www/localhost/error"
          ScriptAlias /cgi-bin/ /var/www/localhost/cgi-bin/
          Alias /blog/ "/var/www/localhost/wordpress"
          Alias /gallery/ "/var/www/localhost/gallery/"
          Alias /wiki/ "/var/www/localhost/wiki/"
        </IfModule>
       
        <Directory /var/www/localhost/icons>
            Options Indexes MultiViews
            Order allow,deny
            Allow from all
        </Directory>
       
        <Directory /var/www/localhost/error>
            Options Indexes MultiViews
            Order allow,deny
            Allow from all
        </Directory>
       
        <Directory /var/www/localhost/cgi-bin>
          Order allow,deny
          Allow from all
        </Directory>
       
        <Directory /var/www/localhost/wordpress>
            Options Indexes
            Order allow,deny
            Allow from all
        </Directory>
       
        <Directory /var/www/localhost/gallery>
            Options Indexes
            Order allow,deny
            Allow from all
        </Directory>

I would very much appreciate being told where I've got this wrong, as it's beginning to annoy me... ^^;

billymayday 09-28-2008 04:00 AM

I don't think you want the trailing slash or quotes, so try
Code:

Alias /icons /var/www/localhost/icons
instead of
Code:

Alias /icons/ "/var/www/localhost/icons"

Tamber-Krain 09-28-2008 07:07 AM

Hmm...
changed the Alias lines like you suggested, then restarted Apache. Unfortunately, this seems to have had no effect. :(

Code:

          Alias /icons /var/www/localhost/icons
          Alias /error /var/www/localhost/error
          ScriptAlias /cgi-bin /var/www/localhost/cgi-bin/
          Alias /blog /var/www/localhost/wordpress
          Alias /gallery /var/www/localhost/gallery/
          Alias /wiki /var/www/localhost/wiki/


billymayday 09-28-2008 04:24 PM

Do you know if the mod_alias test is being triggered?

Can you navigate to file://var/www/localhost/icons/index.html (subsititute a file that's there)?

Are you trying to navigate to httpd://localhost/blog/index.html or just httpd://localhost/blog? I don't see a DirectoryIndex entry anywhere

Tamber-Krain 09-29-2008 06:18 PM

[solved: Pebkac]
 
> Do you know if the mod_alias test is being triggered?

Not a clue, I'm afraid.

> Can you navigate to file://var/www/localhost/icons/index.html (subsititute a file that's there)?

I can, and I can view the file

> Are you trying to navigate to httpd://localhost/blog/index.html or just > httpd://localhost/blog? I don't see a DirectoryIndex entry anywhere

I was just trying to navigate to 'http://localhost/blog/', but I have tried 'http://localhost/blog/index.php' with the same result (404.)
Adding a DirectoryIndex did not help either. :(

EDIT: okay, I found why it didn't work, and now I feel really stupid.
Code:

LoadModule alias_module modules/mod_alias.so
<snip>
<IfModule mod_alias>

the mod_alias in the <IfModule> should be alias_module. I'm not sure why that just clicked now (It may have been the mention of the mod_alias test) but I'm glad it did.

I now present myself for ritual humiliation, as I deserve. :P

billymayday 09-30-2008 04:56 AM

No - it's too easy to miss something that you later think is obvious - that's why I asked you the trigger question. It's too easy to see what you expect when you go over your own work (try proofreading something you've written - then give it to a friend/partner and see how many mistakes they find!)


All times are GMT -5. The time now is 01:56 AM.