【问题标题】:How to solve 403 error when restarting PHP-FPM?重启PHP-FPM时出现403错误如何解决?
【发布时间】:2020-05-24 05:46:59
【问题描述】:

我有一个在 CENTOS 8 上运行的服务器,带有 Apache 4.2 和 PHP-FPM。

当我重新启动 PHP-FPM 服务时,我收到 403 禁止错误。

这是因为/run/php-fpm/www.sock 的所有者变为root 而不是运行Apache 的用户。

我尝试编辑 /etc/php-fpm.d/www.conf 文件,但没有成功

; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server.
; Default Values: user and group are set as the running user
;                 mode is set to 0660
listen.owner = apache
listen.group = apache
listen.mode = 0660

如何在不更改套接字所有者的情况下重新启动 PHP-FPM?

【问题讨论】:

    标签: php apache


    【解决方案1】:

    尝试添加:listen = /path/to/unix/socket 并确保服务使用正确的套接字文件。

    【讨论】:

    • 我已经有 listen = /run/php-fpm/www.sock 并且它是正确的套接字
    【解决方案2】:

    知道了。问题是listen.acl_users

    设置后,listen.owner 和 listen.group 将被忽略。

    解决方案:注释掉这一行:

    ;listen.acl_users = apache,nginx

    【讨论】:

      猜你喜欢
      • 2017-02-04
      • 1970-01-01
      • 1970-01-01
      • 2016-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-04
      • 2016-05-12
      相关资源
      最近更新 更多