Change the site configuration file to block listing out files in the directory - apache2 + Ubuntu
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
2
down vote
favorite
When I access a directory hosted by Apache that does not have a index.php
file or similar, Apache lists the content of the directory for me. How can I block this? I'm using Apache2 on Ubuntu.
server apache2
add a comment |Â
up vote
2
down vote
favorite
When I access a directory hosted by Apache that does not have a index.php
file or similar, Apache lists the content of the directory for me. How can I block this? I'm using Apache2 on Ubuntu.
server apache2
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
When I access a directory hosted by Apache that does not have a index.php
file or similar, Apache lists the content of the directory for me. How can I block this? I'm using Apache2 on Ubuntu.
server apache2
When I access a directory hosted by Apache that does not have a index.php
file or similar, Apache lists the content of the directory for me. How can I block this? I'm using Apache2 on Ubuntu.
server apache2
server apache2
edited Feb 16 at 21:36
![](https://i.stack.imgur.com/AKwUL.png?s=32&g=1)
![](https://i.stack.imgur.com/AKwUL.png?s=32&g=1)
vidarlo
7,21642140
7,21642140
asked Feb 14 at 16:18
user794322
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
In the appropriate <Directory>
stanza. For instance it may look like this:
<Directory /www/somefolder>
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
Change this into
<Directory /www/somefolder>
Options -Indexes FollowSymLinks
AllowOverride None
</Directory>
If there is no Options...
line, you can add one with the content Options -Indexes
for any <Directory...>
stanza. The options are separated by a space ().
Note the - in front of Indexes. This is also covered briefly in the Apache documentation.
The index are generated by mod_autoindex.
Thanks, should i make a new file with the content you provided in the example directory /var/www/filer?
â user794322
Feb 16 at 11:03
No, the best solution is to edit your configuration.
â vidarlo
Feb 16 at 11:35
I tried editing the apache2.conf file and restarted the server, but it didn't work. How can i access the folder trough localhost? When trying to access the folder in the browser, i get the custom error page.
â user794322
Feb 16 at 11:56
@20_90 The default config file for default host is/etc/apache2/sites-available/000-default.conf
. You can also add this to the<Directory /var/www/>
stanza of/etc/apache2/apache2.conf
. Simply put a-
in front ofIndexes
.
â vidarlo
Feb 16 at 21:33
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
In the appropriate <Directory>
stanza. For instance it may look like this:
<Directory /www/somefolder>
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
Change this into
<Directory /www/somefolder>
Options -Indexes FollowSymLinks
AllowOverride None
</Directory>
If there is no Options...
line, you can add one with the content Options -Indexes
for any <Directory...>
stanza. The options are separated by a space ().
Note the - in front of Indexes. This is also covered briefly in the Apache documentation.
The index are generated by mod_autoindex.
Thanks, should i make a new file with the content you provided in the example directory /var/www/filer?
â user794322
Feb 16 at 11:03
No, the best solution is to edit your configuration.
â vidarlo
Feb 16 at 11:35
I tried editing the apache2.conf file and restarted the server, but it didn't work. How can i access the folder trough localhost? When trying to access the folder in the browser, i get the custom error page.
â user794322
Feb 16 at 11:56
@20_90 The default config file for default host is/etc/apache2/sites-available/000-default.conf
. You can also add this to the<Directory /var/www/>
stanza of/etc/apache2/apache2.conf
. Simply put a-
in front ofIndexes
.
â vidarlo
Feb 16 at 21:33
add a comment |Â
up vote
3
down vote
In the appropriate <Directory>
stanza. For instance it may look like this:
<Directory /www/somefolder>
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
Change this into
<Directory /www/somefolder>
Options -Indexes FollowSymLinks
AllowOverride None
</Directory>
If there is no Options...
line, you can add one with the content Options -Indexes
for any <Directory...>
stanza. The options are separated by a space ().
Note the - in front of Indexes. This is also covered briefly in the Apache documentation.
The index are generated by mod_autoindex.
Thanks, should i make a new file with the content you provided in the example directory /var/www/filer?
â user794322
Feb 16 at 11:03
No, the best solution is to edit your configuration.
â vidarlo
Feb 16 at 11:35
I tried editing the apache2.conf file and restarted the server, but it didn't work. How can i access the folder trough localhost? When trying to access the folder in the browser, i get the custom error page.
â user794322
Feb 16 at 11:56
@20_90 The default config file for default host is/etc/apache2/sites-available/000-default.conf
. You can also add this to the<Directory /var/www/>
stanza of/etc/apache2/apache2.conf
. Simply put a-
in front ofIndexes
.
â vidarlo
Feb 16 at 21:33
add a comment |Â
up vote
3
down vote
up vote
3
down vote
In the appropriate <Directory>
stanza. For instance it may look like this:
<Directory /www/somefolder>
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
Change this into
<Directory /www/somefolder>
Options -Indexes FollowSymLinks
AllowOverride None
</Directory>
If there is no Options...
line, you can add one with the content Options -Indexes
for any <Directory...>
stanza. The options are separated by a space ().
Note the - in front of Indexes. This is also covered briefly in the Apache documentation.
The index are generated by mod_autoindex.
In the appropriate <Directory>
stanza. For instance it may look like this:
<Directory /www/somefolder>
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
Change this into
<Directory /www/somefolder>
Options -Indexes FollowSymLinks
AllowOverride None
</Directory>
If there is no Options...
line, you can add one with the content Options -Indexes
for any <Directory...>
stanza. The options are separated by a space ().
Note the - in front of Indexes. This is also covered briefly in the Apache documentation.
The index are generated by mod_autoindex.
answered Feb 14 at 17:48
![](https://i.stack.imgur.com/AKwUL.png?s=32&g=1)
![](https://i.stack.imgur.com/AKwUL.png?s=32&g=1)
vidarlo
7,21642140
7,21642140
Thanks, should i make a new file with the content you provided in the example directory /var/www/filer?
â user794322
Feb 16 at 11:03
No, the best solution is to edit your configuration.
â vidarlo
Feb 16 at 11:35
I tried editing the apache2.conf file and restarted the server, but it didn't work. How can i access the folder trough localhost? When trying to access the folder in the browser, i get the custom error page.
â user794322
Feb 16 at 11:56
@20_90 The default config file for default host is/etc/apache2/sites-available/000-default.conf
. You can also add this to the<Directory /var/www/>
stanza of/etc/apache2/apache2.conf
. Simply put a-
in front ofIndexes
.
â vidarlo
Feb 16 at 21:33
add a comment |Â
Thanks, should i make a new file with the content you provided in the example directory /var/www/filer?
â user794322
Feb 16 at 11:03
No, the best solution is to edit your configuration.
â vidarlo
Feb 16 at 11:35
I tried editing the apache2.conf file and restarted the server, but it didn't work. How can i access the folder trough localhost? When trying to access the folder in the browser, i get the custom error page.
â user794322
Feb 16 at 11:56
@20_90 The default config file for default host is/etc/apache2/sites-available/000-default.conf
. You can also add this to the<Directory /var/www/>
stanza of/etc/apache2/apache2.conf
. Simply put a-
in front ofIndexes
.
â vidarlo
Feb 16 at 21:33
Thanks, should i make a new file with the content you provided in the example directory /var/www/filer?
â user794322
Feb 16 at 11:03
Thanks, should i make a new file with the content you provided in the example directory /var/www/filer?
â user794322
Feb 16 at 11:03
No, the best solution is to edit your configuration.
â vidarlo
Feb 16 at 11:35
No, the best solution is to edit your configuration.
â vidarlo
Feb 16 at 11:35
I tried editing the apache2.conf file and restarted the server, but it didn't work. How can i access the folder trough localhost? When trying to access the folder in the browser, i get the custom error page.
â user794322
Feb 16 at 11:56
I tried editing the apache2.conf file and restarted the server, but it didn't work. How can i access the folder trough localhost? When trying to access the folder in the browser, i get the custom error page.
â user794322
Feb 16 at 11:56
@20_90 The default config file for default host is
/etc/apache2/sites-available/000-default.conf
. You can also add this to the <Directory /var/www/>
stanza of /etc/apache2/apache2.conf
. Simply put a -
in front of Indexes
.â vidarlo
Feb 16 at 21:33
@20_90 The default config file for default host is
/etc/apache2/sites-available/000-default.conf
. You can also add this to the <Directory /var/www/>
stanza of /etc/apache2/apache2.conf
. Simply put a -
in front of Indexes
.â vidarlo
Feb 16 at 21:33
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1006191%2fchange-the-site-configuration-file-to-block-listing-out-files-in-the-directory%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password