Web Hosting Talk







View Full Version : How to remove the permission in apache to allow users to browse a folder.


jonathan184
07-05-2005, 07:33 AM
How to remove the permission in apache to allow users to browse a folder? MY images folder currently saids do not have permission to browse, how do i take this off in apache because i want to hot link in the folder and see the listing of files. Could you tell me what file to edit and what lines to put or remove.

Thanks in advance.

jamesyeeoc
07-06-2005, 12:00 AM
Edit your httpd.conf (global effect) or domain's httpd.include or vhost.conf (per domain effect) file, if you go global (not recommended) find the line 'Options' and add '+Indexes' to the line.

On a per domain basis you can add to vhost.conf or http.include:

<Directory /home/httpd/vhosts/domain.com/httpdocs/foldername>
Options +Indexes
</Directory>

to affect a specific folder. Adjust the actual path according to your particular server.

These are just a couple of examples, there may be others....

jonathan184
07-12-2005, 07:37 AM
Thanks so much i found the full path , what i am trying to do is togrant access to visitors to browse a images folder where i am currently getting a 403 error.

i put this code in the httpd.conf

<Directory /home/virtual/domain.com/images>
Options +Indexes
</Directory>

Restarted apache server

I still get a 403 forbidden error You don't have permission to access /catalog/images/ on this server.

Is there something i am doing wrong?

jamesyeeoc
07-12-2005, 08:07 AM
First, you put ~/domain.com/images , but the error says you tried to access ~/domain.com/catalog/images

So you should modify the httpd.conf to make sure you reference the proper folder.

Then you should also then check the ownership of the proper folder and files. Whichever is the correct one: /domain.com/images or /domain.com/catalog/images. Depending on your exact control panel software it may need to be one of the following:

apache : apache
nobody : nobody

For Plesk it would be:
ftpusername : psacln or ftpusername : psaserv

If you look at the actual domain's document root and see the uid : gid ownership, that may give you a clue to what the other sub-folders should be.

Again, as I stated earlier, you may want to do this per domain in a vhost.conf or vhost_ssl.conf file, rather than doing it globally.