当设置最小的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标准,还是我只使用了奇怪的服务器提供商?
答案 0 :(得分:2)
我的/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>