LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 09-27-2008, 11:32 AM   #1
Tamber-Krain
LQ Newbie
 
Registered: Sep 2008
Distribution: Gentoo 2.6.25-gentoo-r7 x86_64
Posts: 5

Rep: Reputation: 0
Unhappy 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... ^^;
 
Old 09-28-2008, 04:00 AM   #2
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
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"
 
Old 09-28-2008, 07:07 AM   #3
Tamber-Krain
LQ Newbie
 
Registered: Sep 2008
Distribution: Gentoo 2.6.25-gentoo-r7 x86_64
Posts: 5

Original Poster
Rep: Reputation: 0
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/

Last edited by Tamber-Krain; 09-28-2008 at 07:07 AM. Reason: whoops. typo.
 
Old 09-28-2008, 04:24 PM   #4
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
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
 
Old 09-29-2008, 06:18 PM   #5
Tamber-Krain
LQ Newbie
 
Registered: Sep 2008
Distribution: Gentoo 2.6.25-gentoo-r7 x86_64
Posts: 5

Original Poster
Rep: Reputation: 0
Red face [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

Last edited by Tamber-Krain; 09-29-2008 at 06:25 PM. Reason: Solved it... >.>
 
Old 09-30-2008, 04:56 AM   #6
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
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!)
 
  


Reply

Tags
alias, apache2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache error: 404 Not Found, why? cucolin@ Ubuntu 3 08-14-2006 11:01 AM
Apache Alias Returns 404 or "Cannot find server or DNS Error" The00Dustin Linux - Software 3 02-14-2006 12:44 PM
Possible Apache exploit / 404 NOT FOUND rioguia Linux - Security 5 01-03-2006 03:07 PM
alias for directories Tantalos Linux - Newbie 3 09-14-2004 12:34 PM
Apache custom 404 documents Punker51 Linux - Software 2 12-06-2003 03:23 PM


All times are GMT -5. The time now is 10:31 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration