默认情况下,在Ubuntu 12.04 / 14.04 LTS的Apache设置中是否忽略.htaccess文件?

时间:2014-10-13 15:06:39

标签: apache .htaccess ubuntu

当设置最小的Apache安装时(这些天似乎是大多数教程中的标准),就像这样......

(裸体Ubuntu 12.04 / 14.04 LTS)

sudo apt-get install apache2
sudo service apache2 restart

...然后.htaccess文件(即使它们内部只有一个简单的deny from all)被完全忽略(因为vhost默认配置在12.04内部有一个AllowOverride None,在14.04内部没有任何内容)。

问题

这绝对是Ubuntu 12.04 / 14.04 LTS上的Apache2标准,还是我只使用了奇怪的服务器提供商?

1 个答案:

答案 0 :(得分:2)

是的,这是14.04 LTS中Apache的默认配置。

我的/etc/apache2.conf默认拥有此功能:

...
<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
...

/etc/apache2/sites-available/000-default.conf有此

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to...{removed lengthy text}
    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    # Available loglevels..{removed lengthy text}
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at...{removed lengthy text}
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>