为什么lighttpd无法访问fastCGI Unix套接字?

为什么lighttpd无法访问fastCGI Unix套接字?

我有一个 C 应用程序,它通过 Ubuntu 22 上的 fcgi 库打开 fastCGI Unix 套接字。

我尝试从 lighttpd 连接到它,即使我将套接字 chmod 设置为 777,仍然会出现权限被拒绝错误。

什么可能导致错误?

root@vxu22:/etc/lighttpd/conf-enabled# cat 10-fastcgi.conf
server.modules += ( "mod_fastcgi" )
fastcgi.server += ( ".php" =>
    ((
        "socket" => "/home/user/full/path/fcgi.sock",
        "broken-scriptfilename" => "enable"
    ))
)


root@vxu22:/var/log/lighttpd# cat error.log
2023-05-15 16:00:06: (server.c.1551) server started (lighttpd/1.4.63)
2023-05-15 16:00:14: (gw_backend.c.285) establishing connection failed: socket: unix:/home/user/full/path/fcgi.sock: Permission denied
2023-05-15 16:00:14: (gw_backend.c.995) all handlers for /login? on /login are down.
2023-05-15 16:00:16: (gw_backend.c.362) gw-server re-enabled: unix:/home/user/full/path/fcgi.sock  0 /home/user/full/path/fcgi.sock


root@vxu22:/var/log/lighttpd# ls -l /home/user/full/path/fcgi.sock
srwxrwxrwx 1 user users 0 May 15 15:31 /home/user/full/path/fcgi.sock=

答案1

Tom Yan 的评论是正确的 - 问题不在于文件权限而在于文件位置。

将套接字移至 /var/www/html/ 后,连接成功。

相关内容