【问题标题】:Change AllowOverride None to AllowOverride All将 AllowOverride None 更改为 AllowOverride All
【发布时间】:2025-12-24 04:30:17
【问题描述】:

这两个文件里面的代码是一样的。

/etc/apache2/sites-enabled/000-default

/etc/apache2/sites-available/default

我想将 AllowOverride None 更改为 AllowOverride All。 我应该改哪个文件?

是否所有 AllowOverride None 都更改为 AllowOverride All

<VirtualHost *:80>

    DocumentRoot /var/www/drupal
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/drupal>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

【问题讨论】:

    标签: apache .htaccess


    【解决方案1】:

    /etc/apache2/sites-enabled/000-default

    /etc/apache2/sites-available/默认

    实际上这些不是 2 个文件。一个是另一个的symlink。这就是为什么它们完全相同。

    站点-可用仅显示您的系统上有哪些站点。但是站点-启用会显示正在使用的站点。

    所以只需更改sites-available 中的原始文件,因为它们是同一个文件。是的,使用AllowOverride All&lt;Directory /var/www/drupal&gt; 块下启用.htaccess 使用。

    如果您以后添加更多站点,您可以使用命令a2ensitea2dissite 来启用和禁用站点。如果您需要这样做,下面的链接会给出确切的说明,因为您的网站已经上线,所以您不应该这样做。

    http://manpages.ubuntu.com/manpages/trusty/man8/a2ensite.8.html

    【讨论】: