You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 03:22:17