Enable Directory Listing

Discussion in 'Installation/Configuration' started by smakynet, Apr 4, 2009.

  1. smakynet

    smakynet New Member

    I need to figure out how to enable directory listing.

    Right now I get the error "Browsing this directory is forbidden"

    Does anyone know how to enable Directory browsing globally?

    Any help is appreciated!
     
  2. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Add the following code in the apache2.conf file:

    <Directory /var/www>
    Options +Indexes
    </Directory>
     
  3. Bikkies

    Bikkies New Member

    If you want to configure for just a particular site/sub-directory, it can also go in the Apache Directives for required web in ISPConfig2.
    Unsure about ISPConfig3

    e.g.-
    Code:
    <Directory /var/www/web3/web/mysql-backup-reports>
    Options +Indexes
    </Directory>
    
     
  4. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Same for ispconfig 3.
     
  5. edge

    edge Active Member Moderator HowtoForge Supporter

    For some reason I can not get this to work in ISPconfig3
    When looking at the .vhost file it does show the added data.

    I have tested this with client ID and domain.
    Code:
    <Directory "/var/clients/client17/web59/web/download">
    Options +Indexes
    </Directory> 
    and
    Code:
    <Directory /var/www/the-domain.nl/web/download>
    Options +Indexes
    </Directory> 
    Both ways give an ERROR 403 - Forbidden!
    Is it only me who is having this problem? if so.. What could it be?
     
    Last edited: Aug 4, 2009
  6. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Looks correct so far. Have you took a look at the error log in the website?
     
  7. edge

    edge Active Member Moderator HowtoForge Supporter

    The error in the log file reads:
    It's correct that it can not find the index.php as it does not have one!
    I want it to show the directory listing!
     
  8. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Does the site contain a .htaccess file that might apply some rewriting?
     
  9. edge

    edge Active Member Moderator HowtoForge Supporter

    I mist your reply, so sorry for the delay on your question.
    And.. No... No .htaccess at all on that site!

    I've only added
    to the Apache Directives of the website in question.
     
  10. Doug G

    Doug G Member HowtoForge Supporter

    fwiw I just went through this on a test server, it seems to me I had to manually restart or reload apache to get the new directory directive to be recognized and the forbidden message to go away. I put the directive in the additional apache directives in ispconfig3. This was done on centos 5.3
     
  11. edge

    edge Active Member Moderator HowtoForge Supporter

    Thank you for your input Doug G,

    I've tried this several times, but till now I still get the ERROR 403 - Forbidden!

    I'm lost on this one.... I have no clue on how to fix this.
     
  12. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    There is no manual restart nescessary as it is done by ispconfig anyway after the configuration file has been written. You just have to wait at least one minute until the new config is written to disk. You can se this in the jobqueue in the monitor.
     
  13. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Try to add also the second path. Example:

    <Directory /var/www/clients/clientX/webX/web/download>
    Options +Indexes
    </Directory>

    DEpending on the php method you had choosen, apache might use the real path and not the symlinked path.
     
  14. edge

    edge Active Member Moderator HowtoForge Supporter

    Thank you for giving me things to try.

    The "DEpending on the php method you had choosen" got me thinking!
    I've disabled PHP for this client's site (it's only using html, and he did not want PHP).
    Guess what.. Afer enabling PHP directory listing started to work!

    So.. Now I have to find a way to get directory listing to work without enabling PHP!
     
  15. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    I wrote the solution above.
     
  16. edge

    edge Active Member Moderator HowtoForge Supporter

    The way I read your solution is that PHP needs to be enabled!
    I would like to be able to use directory listing without PHP. (PHP disabled)
     
  17. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    The solution is the same even for not enabling PHP. Either the symlinked or real path will work.
     
  18. edge

    edge Active Member Moderator HowtoForge Supporter

    I must be missing something in your posts.
    Whatever way I try or set the path.. As soon as I disable PHP for that client, the directory listing does not work anymore.

    So. If my client wants to have directory listing he will need to live with the PHP option on :)
     
  19. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Please post all directory directives that you have added when php is disabled and the directory listing does not work.
     
  20. edge

    edge Active Member Moderator HowtoForge Supporter

    Only working when PHP is enabled:
    Only working when PHP is enabled:
    Not working at all:
     

Share This Page