Ubuntu 22.04升级后WordPress/Apache出现AH01797权限拒绝问题
Ubuntu 22.04升级后WordPress站点权限访问错误
问题现象
- 访问WordPress后台页面(如wp-admin/customize.php、wp-admin/post.php)时,页面提示:
您无权访问此资源。 - Apache2错误日志记录:
另一条错误日志示例:[access_compat:error] [pid 1619605] [client 185.224.57.161:58465] AH01797: client denied by server configuration: /var/www/example/wp-admin/customize.php, referer: http://www.example.com/[Thu Oct 12 15:45:52.657776 2023] [access_compat:error] [pid 3070059] [client 217.116.228.14:60801] AH01797: client denied by server configuration: /var/www/example/wp-admin/post.php, referer: http://www.example.com/
当前Apache站点配置(site.conf)
<VirtualHost *:80> ServerName example.com DocumentRoot /var/www/example <Directory /var/www/example> AllowOverride all Require all granted </Directory> <Directory /var/www/example/wp-admin> AllowOverride all Require all granted </Directory> DirectoryIndex index.php WSGIDaemonProcess flaskapp user=username group=username threads=5 WSGIScriptAlias /create /var/www/flask/flaskapp.wsgi ErrorLog ${APACHE_LOG_DIR}/word_error.log </VirtualHost>
已完成的排查
- 已按照标准WordPress权限方案设置文件权限
- 当前运行Apache版本:Apache/2.4.57 (Ubuntu)
- 进程用户验证:执行
ps aux | egrep '(apache|httpd)',确认触发错误的进程(PID 3070059)由www-data用户运行 - 文件权限验证:执行
ls /var/www/example/ -lh,确认站点所有文件和目录的所有者及组均为www-data
内容的提问来源于stack exchange,提问作者axel_ande
相关产品推荐
相关产品推荐

