簡體   English   中英

將Apache配置從2.2遷移到2.4

[英]Migrating Apache configuration from 2.2 to 2.4

我正在使用該Apache conf來使用登錄名/密碼來鎖定/ wp-admin /區域,但是我不確定我的新Apache 2.4 conf部件是否正確,有人可以幫助我嗎?

<Directory "/opt/bitnami/apps/wordpress/htdocs/wp-admin">
    AuthType Basic
    AuthName "Restricted files"
    AuthUserFile "/opt/bitnami/apache2/wordpress_users"
    Require valid-user

    # Apache 2.2
    <IfModule !mod_authz_core.c>
        Order Deny,Allow
        Deny from all
        <Files admin-ajax.php>
            Order allow,deny
            Allow from all
            Satisfy any
        </Files>
    </IfModule>

    # Apache 2.4
    <IfModule mod_authz_core.c>
        Require all denied
        <Files admin-ajax.php>
            Require all granted
        </Files>
    </IfModule>    
</Directory>

您修改了哪個Apache配置文件? 您是否要在文件/opt/bitnami/apps/wordpress/conf/htaccess.conf中引入更改? 如果您使用其他文件,請使用此文件。

AuthUserFile "/opt/bitnami/apache2/wordpress_users"

該文件存在嗎? 您是否使用htpasswd創建了它? 請在下面的鏈接中找到完整的文檔:

https://httpd.apache.org/docs/2.4/mod/mod_authn_file.html

我還將在下面添加以下行以說明為什么您不允許訪問某些文件:

ErrorDocument 403 "For security reasons, this file is not accessible."

請記住通過運行以下命令重新啟動Apache以加載所有更改:

sudo /opt/bitnami/ctlscript.sh restart apache

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM