LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   CentOS (https://www.linuxquestions.org/questions/centos-111/)
-   -   apache - show directory content (https://www.linuxquestions.org/questions/centos-111/apache-show-directory-content-4175538930/)

robertkwild 04-06-2015 01:16 PM

apache - show directory content
 
hi all,

i want to view my directory content using apache , so when i go to http://apache-server/folder_name, i will see the content of that directory on the website

can anyone help please

many thanks,

rob

T3RM1NVT0R 04-06-2015 01:35 PM

To enable that you have to make sure that your /etc/httpd/conf/httpd.conf which includes the section for your website have Indexes option enabled as follows:

Code:

Options Indexes FollowSymLinks

robertkwild 04-06-2015 02:01 PM

i have created this paragraph -

<Directory /apache_test/>
Options Indexes FollowSymLinks
Order allow,deny
allow from all
</Directory>

will this work

T3RM1NVT0R 04-06-2015 02:09 PM

Yes, it should work. Make sure to restart httpd after making changes to httpd.conf file.

robertkwild 04-06-2015 02:49 PM

mmmm, i have restarted httpd, i get The requested URL /apache_test/ was not found on this server.

http://10.10.1.1/apache_test/

i have created that directory on my apache server and some sub folders underneath the root folder

T3RM1NVT0R 04-06-2015 02:54 PM

What is the output of the following:

Code:

ls -al /var/www/html

robertkwild 04-06-2015 03:16 PM

output of the var/www/html is -
.
..

but my apache_test is in the base directory

T3RM1NVT0R 04-06-2015 03:17 PM

Which base directory? Did you try putting it in /var/www/html and then give it a try?

robertkwild 04-06-2015 03:19 PM

no i put the apache_test dir in the /, i havnt put apache_test in var/www/html

EDIT - so i have made a apache_test dir under the /var/www/html and i can browse the dir but what if i dont want to put it under that dir and want to put it under /

T3RM1NVT0R 04-06-2015 03:25 PM

First of all it is not a good idea to use / as the root directory for apache. If you really want to use it then you have to make the change to the following parameter in /etc/httpd/conf/httpd.conf:

From:
Code:

DocumentRoot "/var/www/html"
to:
Code:

DocumentRoot "/"
I haven't tried that before because I never wanted to use / to be used by httpd.

robertkwild 04-06-2015 03:35 PM

great thanks,

i want to be able to browse my directory list but when i click on a document file i dont want the end users to see the contents of that file

so i want them to see the actual file name and NOT the contents of that file

is this possible

T3RM1NVT0R 04-06-2015 03:45 PM

To be honest that doesn't make sense at all. I mean if you don't want them to see the contents then why you are putting it there on the first place. I mean why you want them to see just the filename and not able to download it.

It is possible but as I said doesn't make sense at all. To make it possible you have to make sure that the file is owned by root and it has got 600 permission, that is only readable and writable by root. By making this change users will be able to see the file name but won't be able to see the contents or won't be able to download it.

robertkwild 04-06-2015 03:59 PM

ok great thanks terminator, i will mess about and see if its what im looking for.

thanks very much for your help

rob

T3RM1NVT0R 04-06-2015 04:05 PM

You're welcome!

Please mark the thread as solved if you think your queries have been answered.

Enjoy Linux!!!


All times are GMT -5. The time now is 05:45 AM.