尝试在 apache2 中启用 .htacccess,但我的 default.conf 相对为空

尝试在 apache2 中启用 .htacccess,但我的 default.conf 相对为空

我一直尝试在运行于 ubuntu 14.04 的 apache2 中为我的所有域启用 .htaccess,但是/etc/apache2/sites-available与指南中所说的相比,我的默认配置文件显得相当贫瘠。

这是我的000-default.conf文件:

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port t$
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin [email protected]
    DocumentRoot /var/www/html

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #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 a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

指南建议它应该看起来像,或者有这个部分:

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
    # Uncomment this directive is you want to see apache2's
    # default start page (in /apache2-default) when you go to /
    #RedirectMatch ^/$ /apache2-default/
</Directory>

我已将建议的代码添加到我的000-default.conf文件中,并重新启动了 apache2,但什么也没发生。没有错误消息,它只是正常重新启动并重新加载。

什么都没有改变,.htaccess 文件仍然被忽略。任何能给我的帮助我都会非常感激。

答案1

我的问题是我试图/var/www/在我的000-default.conf文件中使用实际使用的/var/www/html,并且我基本上将该错误复制到我尝试过的每个子域(只会告诉它使用/var/www/而不是实际子域的文件夹)。

相关内容