The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to enable Fancy Directory Indexing in Apache 2.2

Discussion in 'EasyApache' started by sneader, Jan 26, 2009.

  1. sneader

    sneader Well-Known Member

    Joined:
    Aug 21, 2003
    Messages:
    1,126
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    La Crosse, WI
    cPanel Access Level:
    Root Administrator
    I recently upgraded Apache and some customers noticed that their directory listings lost the FancyIndexing functionality. i.e. if you put some files in a directory, and don't put an index.html file in that directory, then anyone browsing that directory will see a list of files. Prior to the upgrade, information such as file size, date, etc. were visible, and you could sort on each column.

    I did some searching here on the forum, and could not find out how to re-enable fancy indexing (except a couple links to an article at servertune.com that is no longer visible unless you are a customer)

    So, I did some further research, and came up with my own instructions, and thought I would share for anyone else looking for this. If you have suggestions on ways to make this easier, I am all ears. :)

    1. cd /usr/local/apache/conf/extra and verify that httpd-autoindex.conf exists. Don't do anything with it, just make sure it is there.
    2. open /usr/local/apache/conf/httpd.conf and do a find and look for the section of the config where some "IfModule" entries exist. Then enter this module somewhere in that section:

      <IfModule mod_autoindex.c>
      IndexOptions FancyIndexing IconHeight=16 IconWidth=16
      </IfModule>

      (EDIT: HelloAdam suggested that we should use IconHeight=22 IconWidth=20 instead, as these are the values that Apache 1.3 used)
    3. Exit the edit session and save your work.
    4. Now you must "distill" the changes (assuming you are using Easy Apache). Enter this command:

      /usr/local/cpanel/bin/apache_conf_distiller --update

      You should get back "Distilled successfully".
    5. Now you will rebuild your httpd.conf, and see if the changes you made stuck. Enter this command:

      /usr/local/cpanel/bin/build_apache_conf

      You should get back "Built /usr/local/apache/conf/httpd.conf OK"
    6. Open /usr/local/apache/conf/httpd.conf again, and make sure that your IfModule addition is still there. If so, success !!
    7. Restart Apache. I prefer to do it via WHM's Restart Apache link. YMMV.

    I have attached screen shots of a directory listing, BEFORE and AFTER.

    I hope this is useful to someone.

    - Scott
     

    Attached Files:

    #1 sneader, Jan 26, 2009
    Last edited: Mar 27, 2009
    arunsv84, rone, cPanelKenneth and 3 others like this.
  2. rhenderson

    rhenderson Well-Known Member

    Joined:
    Apr 21, 2005
    Messages:
    785
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Oklahoma
    cPanel Access Level:
    Root Administrator
    Nice post, we had already done that but glad you shared. Gave you a rep point for that.
     
  3. sneader

    sneader Well-Known Member

    Joined:
    Aug 21, 2003
    Messages:
    1,126
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    La Crosse, WI
    cPanel Access Level:
    Root Administrator
    Thanks Randy. Wow, I've been on this forum for 5.5 years, and I didn't know about the reputation system! :eek:

    Checking it out...

    - Scott
     
  4. HelloAdam

    HelloAdam Well-Known Member

    Joined:
    Nov 6, 2005
    Messages:
    145
    Likes Received:
    0
    Trophy Points:
    16
    Scott,

    The correct height/weight are pasted below. These are the same settings used by Apache 1.3.x

    IconHeight=22 IconWidth=20

    Thanks,
    Adam
     
  5. schoeps

    schoeps Well-Known Member

    Joined:
    Sep 22, 2004
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    6
    Thanks for this post! Not sure if it matters (prolly doesn't), but when you closed the IfModule in that insert, you posted it in lowers. (ifModule)

    Any clue how to get them to look like this?
    http://www.ibiblio.org/pub/

    Thanks again,
    Bri
     
  6. sneader

    sneader Well-Known Member

    Joined:
    Aug 21, 2003
    Messages:
    1,126
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    La Crosse, WI
    cPanel Access Level:
    Root Administrator
    It apparently doesn't matter, but thanks for catching that... I have fixed it in the instructions above.

    - Scott
     
  7. arunsv84

    arunsv84 Well-Known Member

    Joined:
    Oct 20, 2008
    Messages:
    373
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    127.0.0.1
    cPanel Access Level:
    Root Administrator
    Hello sneader,

    Thanks for sharing this :)

    Nice post. Rep added,,,:D
     
  8. sneader

    sneader Well-Known Member

    Joined:
    Aug 21, 2003
    Messages:
    1,126
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    La Crosse, WI
    cPanel Access Level:
    Root Administrator
    I wish I did -- I would prefer that it look like that also.

    - Scott
     
  9. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,478
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    I think that's what the first post is about, isn't it? This link ibiblio.org/pub/ is using the larger icon size as mentioned in first post:

    And you can easily replace the icons themeselves with anything you like.
     
  10. StingRay2k01

    StingRay2k01 Active Member

    Joined:
    Jun 15, 2003
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    If you want to avoid the distiller/shell and do it a little fast you could just add it in WHM.

    WMM -> Apache Configuration -> Include Editor -> Pre Main Include -> All Versions.

    Then just copy and paste this in:

    <IfModule mod_autoindex.c>
    IndexOptions FancyIndexing IconHeight=22 IconWidth=20
    </IfModule>

    Click on update, apache will restart and you are done.

    Worked for me :)
    Thanks to the OP for the tip!
     
  11. Kasper

    Kasper Active Member

    Joined:
    Aug 26, 2004
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Chicago
    Include

    The more accurate way to do that would add

    Include "/usr/local/apache/conf/extra/httpd-autoindex.conf"

    To pre_main_global.conf as adding IfModule entries will override the settings like FolderFirst in autoindex.conf file (v 2.2.11-13)
     
Loading...

Share This Page