![您无权访问此服务器上的 /wp-admin/install.php](https://linux22.com/image/1012639/%E6%82%A8%E6%97%A0%E6%9D%83%E8%AE%BF%E9%97%AE%E6%AD%A4%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E7%9A%84%20%2Fwp-admin%2Finstall.php.png)
我现在正在进行迁移,完成所有必要的步骤后,当我尝试访问网站时遇到了这个错误。
You don't have permission to access /wp-admin/install.php on this server.
我确实检查了我的错误日志并且它显示了以下内容:
sudo tail -10 /var/log/apache2/error.log
错误如下:
[Fri Mar 29 16:26:58.360971 2019] [access_compat:error] [pid 41530] [client 66.102.6.237:43764] AH01797: client denied by server configuration: /var/www/html/path_to_files/wp-admin/install.php
[Fri Mar 29 16:29:21.855448 2019] [mpm_prefork:notice] [pid 41505] AH00169: caught SIGTERM, shutting down
[Fri Mar 29 16:29:22.220074 2019] [mpm_prefork:notice] [pid 41633] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Fri Mar 29 16:29:22.220165 2019] [core:notice] [pid 41633] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 29 16:29:57.546844 2019] [mpm_prefork:notice] [pid 41633] AH00169: caught SIGTERM, shutting down
[Fri Mar 29 16:29:57.653695 2019] [mpm_prefork:notice] [pid 41707] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Fri Mar 29 16:29:57.653762 2019] [core:notice] [pid 41707] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 29 16:30:05.134525 2019] [access_compat:error] [pid 41726] [client 130.63.49.63:52630] AH01797: client denied by server configuration: /var/www/html/path_to_files/wp-admin/install.php
[Fri Mar 29 16:42:30.993688 2019] [access_compat:error] [pid 41732] [client 130.63.49.63:52828] AH01797: client denied by server configuration: /var/www/html/path_to_files/wp-admin/install.php
[Fri Mar 29 16:42:34.331212 2019] [access_compat:error] [pid 41732] [client 130.63.49.63:52828] AH01797: client denied by server configuration: /var/www/html/path_to_files/wp-admin/install.php
我的.conf如下:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
DocumentRoot /var/www/html/path_to_files
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Apache2 版本:2.4.29(Ubuntu)。我的文件权限已设置为755。
关于如何解决此问题的任何帮助都将非常有帮助。
.htaccess 代码:
<files .htaccess>
Order allow,deny
Deny from all
</files>
<files readme.html>
Order allow,deny
Deny from all
</files>
<files readme.txt>
Order allow,deny
Deny from all
</files>
<files install.php>
Order allow,deny
Deny from all
</files>
<files wp-config.php>
Order allow,deny
Deny from all
</files>
答案1
您需要暂时禁用对 php 安装文件的阻止访问,安装完成后 - 再次启用阻止。Deny from all
阻止所有人访问。Allow from your-ip
将只为您启用访问。将“允许”放在单独一行的拒绝之前。
本节:
<files install.php>
Order allow,deny
Deny from all
</files>
<files wp-config.php>
Order allow,deny
Deny from all
</files>
更新:不再使用顺序、允许、拒绝,而是有一个新的选项“要求”,因此部分应该如下所示:
<files install.php>
Require host address
# or Require ip ip.address
# or Require local
</files>