LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 04-06-2015, 01:16 PM   #1
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Rep: Reputation: Disabled
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
 
Old 04-06-2015, 01:35 PM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
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
 
Old 04-06-2015, 02:01 PM   #3
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
i have created this paragraph -

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

will this work
 
Old 04-06-2015, 02:09 PM   #4
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Yes, it should work. Make sure to restart httpd after making changes to httpd.conf file.
 
Old 04-06-2015, 02:49 PM   #5
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
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

Last edited by robertkwild; 04-06-2015 at 02:52 PM.
 
Old 04-06-2015, 02:54 PM   #6
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
What is the output of the following:

Code:
ls -al /var/www/html
 
Old 04-06-2015, 03:16 PM   #7
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
output of the var/www/html is -
.
..

but my apache_test is in the base directory
 
Old 04-06-2015, 03:17 PM   #8
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Which base directory? Did you try putting it in /var/www/html and then give it a try?
 
Old 04-06-2015, 03:19 PM   #9
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
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 /

Last edited by robertkwild; 04-06-2015 at 03:24 PM.
 
Old 04-06-2015, 03:25 PM   #10
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
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.
 
Old 04-06-2015, 03:35 PM   #11
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
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
 
Old 04-06-2015, 03:45 PM   #12
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
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.
 
Old 04-06-2015, 03:59 PM   #13
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
ok great thanks terminator, i will mess about and see if its what im looking for.

thanks very much for your help

rob
 
Old 04-06-2015, 04:05 PM   #14
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
You're welcome!

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

Enjoy Linux!!!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
show the directory content using read command bloodstreetboy Linux - Newbie 5 10-15-2013 03:23 AM
Evolution does not show content of inbox or sent but does show other folders manny_borges Linux - Newbie 1 05-07-2011 05:08 PM
directory content on apache spank Linux - Newbie 1 09-23-2005 02:40 PM
Apache: show mp3 id tags in directory browsing? wijnands Linux - Software 1 08-09-2005 07:09 AM
Apache serving content after the content is removed? jrbush82 Linux - Software 6 05-05-2004 04:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration