Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Apache directory listing


    Hello!

    I recently installed Apache http server on my linux distribution Fedora Core 3. It's main folder is now set to /var/www/html but I would like to change default folder to /home/ftp/pub which is already used by vsftpd. What do I have to change now in config file so Apache will list files from my anonymous FTP folder (/home/ftp/pub) but not load index files from /var/www/html? I already tried to use "alias" in config file but without success. Everytime I get "403 Forbidden" error.
    Any ideas how to do that?

    Regards,
    krneki

  2. #2
    Edit /etc/apache2/default-server.conf and edit this line:

    DocumentRoot "/srv/www/htdocs"

    Try inserting DocumentRoot "/srv/html"

    Then restart apache2 and see what happens.

    Of course, my example is from SuSE - noting the default /srv/www/htdocs; however, editing this line "should" take care of your problem, just make sure to restart the daemon once completed and most important, ensure to make a copy of this file prior to editing. Let us know if it works.

  3. #3
    Oops, got confused, try inserting the following:

    DocumentRoot "/srv/ftp"

    You may have to chmod to get this to work.

  4. $spacer_open
    $spacer_close
  5. #4
    My FTP directory is /home/ftp2/pub . I tried to inserted it into config file but when I started Apache I got error "Warning: DocumentRoot [/home/ftp2/pub] does not exist".
    I still get 403 Forbidden error. Any new ideas?

  6. #5
    It's a permissions issue. Why don't you point it to the /srv/ftp directory? Your user account is the owner of the /home/ftp2/pub directory; therefore, you are receiving the error. Try chmod!

  7. #6
    Linux Enthusiast
    Join Date
    Aug 2005
    Location
    Hell
    Posts
    514
    Quote Originally Posted by krneki
    Hello!

    I recently installed Apache http server on my linux distribution Fedora Core 3. It's main folder is now set to /var/www/html but I would like to change default folder to /home/ftp/pub which is already used by vsftpd. What do I have to change now in config file so Apache will list files from my anonymous FTP folder (/home/ftp/pub) but not load index files from /var/www/html? I already tried to use "alias" in config file but without success. Everytime I get "403 Forbidden" error.
    Any ideas how to do that?

    Regards,
    krneki
    Fedora Core has SELinux which enforces that things need to have the right "context" to be accessible by Apache. /var/www/html and stuff created in it automatically inherit the right context, but things created in other places do not. Do something like
    Code:
    chcon -R -t httpd_sys_content_t /home/ftp/pub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •