Apache ルールは他のルールによってオーバーライドされます。

Apache ルールは他のルールによってオーバーライドされます。

私は次のようにhttpd.confファイルの.htaccessファイルをブロックしました:Requests Denied All

私のhttpd.conf:

ServerRoot "/etc/httpd"
Listen 80
Include conf.modules.d/*.conf

User apache
Group apache

<Directory />
    AllowOverride none
    Require all denied
</Directory>

DocumentRoot "/var/www/html"

<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

<Directory "/var/www/html">
    Options -Indexes +FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

<Files ~ "^\.?ht(access|passwd)(\.dist)?">
    Require all denied
</Files>

IncludeOptional sites/*.conf

これは私の仮想ホストです。

<VirtualHost *:80>
        ServerName example.com

        DocumentRoot /var/www/site/

        <Location />
            AuthUserFile /etc/httpd/conf/passwd
            AuthName "ADMIN AREA"
            AuthType Basic
            require valid-user
            Order allow,deny
            Allow from 10.0.0.0/8
            satisfy any
        </Location>


        <Directory /var/www/site/>
                Options +FollowSymlinks -Multiviews
                AllowOverride all
                Require all granted
        </Directory>

</VirtualHost>

現在位置ディレクティブを使用して特定のIPアドレスにのみアクセスを許可するか、ログインとパスワードを使用すると、そのアドレスが.htaccessファイルにアクセスできるようになります。この問題をどのように解決できますか?誰も.htaccessを見ることができません。

ベストアンサー1

以前のガイドラインと新しいガイドラインを混在させると、意図しない結果が生じる可能性があります。具体的には、mod_access_compatこのようなタスクを処理するために使用され、新しいガイドラインよりもOrder allow,deny優先されます。mod_authz_hostバラより2.4にアップグレード

おすすめ記事