简体   繁体   English

apache2配置不起作用

[英]apache2 configuration not working

Now this is likely to be a dumb question as I'm new to Apache and web hosting in general. 现在,这可能是一个愚蠢的问题,因为我是Apache和Web托管的新手。 I'm trying to set configuration options for apache but none of them are working. 我正在尝试为apache设置配置选项,但是它们都不起作用。

The first option I'm trying to set is disabling directory indexes. 我要设置的第一个选项是禁用目录索引。 The directory /var/www/schedules/ has no index.html and I'm trying to get it to display a 403 Forbidden on accessing /schedules . 目录/var/www/schedules/没有index.html ,我正试图让它显示对/schedules禁止访问的403。 I put Options -Indexes at the beginning of /etc/apache2/apache2.conf but it has no effect. 我将Options -Indexes放在/etc/apache2/apache2.conf的开头,但是没有效果。 I then tried 然后我尝试了

<Directory />
    Options -Indexes
</Directory>

but it also had no effect. 但这也没有效果。 I replaced <Directory /> with <Directory /var/www/> but it also had no effect. 我用<Directory /var/www/>替换了<Directory /> ,但这也没有任何效果。 The only thing that worked was replacing it with <Directory /var/www/schedules/> . 唯一有效的方法是用<Directory /var/www/schedules/>替换它。 This doesn't seem to disable directory indexing globally however. 但是,这似乎并未禁用全局目录索引。

The other thing I'm trying to do is blocking access by IP. 我想做的另一件事是阻止IP访问。 However even the simplest things don't work. 但是,即使最简单的事情也无法正常工作。 I added to apache2.conf this: 我在apache2.conf添加了这个:

<Directory />
    Order allow,deny
    Deny from all
</Directory>

but it didn't work; 但是它没有用; I could still access all the pages. 我仍然可以访问所有页面。 Tried <Directory /var/www> , also didn't work. 尝试<Directory /var/www>也不起作用。

Using Ubuntu 12.04.3 LTS. 使用Ubuntu 12.04.3 LTS。

<Directory ~ "/var/www/.*">
    #...options...
</Directory>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM