Turn off directory listing just for the specified directory
<Directory “/var/www/html/media”>
@Inderpreet and others please see is it correct and can i submit the task.
Task:
Step1: edited httpd config file vi /etc/httpd/conf/httpd.conf as below
Step2: created .htaccess file under /var/www/html/news and added “Options -Indexes” in the file.
Step3: restarted httpd and made sure that httpd is running.
Is their any way to verify my activity is correct?
If not can i go ahead and submit hoping it is correct.
Thanks,
Yogendra
Check in Display port section. It will show you web page. If you did correct then it will not show you apache web server version.
Hi @Tej-Singh-Rana thanks for replying.
Could you please guide me where exactly i need to verify, i am not sure Display port section means. Kindly assist.
Thanks,
Yogendra
In the Web preview section right? that section have Select Port to view Host 1. This option will show you page after giving Port input in blank box.
@yogendra are you able to complete the task?
if yes kindly help
i just don’t understand what the steps to be done for Q.no a.
thanks
Hi @karthikms
I have worked as mentioned in my snips above, unfortunately i ended up with result as Task Failed.
Please do some more research from your end (i was able to do only as above) and try to perform, all the best.
Regards,
Yogendra
i think you were supposed to do All access granted . i think thats where you went wrong.
thanks @yogendra
I tired to access the " Select Port to view Host 1" and choose the port number as 8080…but still I’m getting view of Quiz question page…which port number should i give the view the apache web page
@Salim @devops503 @Inderpreet @Tej-Singh-Rana
Hi All,
As part of this task.
Before updating the httpd.conf.
I added the below commands towards the end of httpd.conf.
other than this changes, I didn’t do any other changes. the task was failed after submitted.
let me know where did I go wrong. Thank you!
Swaroop
Please take a look to
sudo systemctl start httpd
sudo systemctl status httpd
Added below 2 lines end of config file : /etc/httpd/conf/httpd.conf
ServerTokens Prod
ServerSignature Off
Modified below details in config file
<Directory “/var/www/html”>
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
sudo systemctl restart httpd
Its worked for me.
Got succeeded with above leads. Thanks devops503 and selvag.
Hi @Salim,
In your steps you forgot to include on how to hide apache version number.
For all - please refer below tutorials for this task.
Thanks,
Bhargav
Hi @Salim,
In your steps you forgot to include on how to hide apache version number.
For all - please refer below tutorials for this task.
Thanks,
Bhargav
Hello @Inderpreet @Tej-Singh-Rana, can you please help here to understand
I IONOS Cloud Documentation - Products to disable the directory listing)
- Please suggest what is wrong. Is it because I have marked the directive
AllowOverride
asNone
. Should this beAll
? - As per Disable Apache Web Directory Listing Using .htaccess File, it says to create
.htaccess
file.
a. What is the difference between creating this file and updating the same details in httpd.conf file?
b. which path do I need to create.htaccess
file?
c. Also how is there a way to verify if directory listing has been disabled?
Hi @praddasg
-
AllowOverride All
means you are allowing Apache to overwrite config settings for a particular directory location using.htaccess
file. If you have setAllowOverride None
then even if you keep.htaccess
under that directory location it won’t be effective. -
Whatever path is asked in the question to disable directory listing for e.g
/var/www/html/
-
Lets say if apache document root is
/var/www/html
and you have disabled directory listing for/var/www/html/somedir
then you can check in the browser by opening this URLhttp://<your-website>/somedir
, it should not list thefiles/directories
present under/var/www/html/somedir
directory.
Hi @Inderpreet @Tej-Singh-Rana
Is there any other way to verify if directory listing is indeed disabled using curl or any other command line utility?
The challenge here is, I am not able to verify using browser
If you are seeing your data listed in the browser after accessing "http://“your-website”/somedir URL then directory listing isn’t disabled for this directory.
You can also use command line utility like elinks
to test the same.