0

(也发布到 FastCGI++-users 邮件列表,但是它在很长一段时间内都没有活动)

我目前正在尝试在我正在编写的应用程序中使用 FastCGI++(2.1 版)库。该应用程序将作为 linux 机器上的守护进程运行,并通过 lighttpd 提供状态网页。我打算使用 FastCGI++ 接口定期自动更新状态网页。

我已经开始向我的应用程序添加一个线程,该线程创建一个 FastCGI++ 管理器的实例,并回显一个字符串文字以响应任何请求(与 Hello World 示例基本相同)。

但是,我似乎无法在浏览器中访问它,并且我怀疑我错误地配置了 lighttpd fastcgi 模块(/etc/lighttpd/lighttpd.conf 包含在下面)。lighttpd 错误日志记录了“unix 上没有这样的文件或目录:/tmp/Myapp.sock”。

将 lighttpd 配置为与实现 fastcgi++ 库的守护进程接口的正确方法是什么?是否有必要使用 spawn-fcgi 启动守护进程?

谢谢,

麦克风

猫 /etc/lighttpd/lighttpd.conf:

server.modules = (
    "mod_access",
    "mod_alias",
    "mod_compress",
    "mod_redirect",
        "mod_rewrite",
    "mod_cgi",
    "mod_fastcgi",
)

server.document-root        = "/var/www/html"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 80

cgi.assign = (".py" => "/usr/bin/python3")
fastcgi.debug = 1
fastcgi.server = ( "/device" => (( 
                    "socket" => "/tmp/Myapp.sock",
                    "check_local" => "disable",
                    "docroot" => "/"
                ))
        )

index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
4

1 回答 1

0

“unix 上没有这样的文件或目录:/tmp/Myapp.sock”

这意味着套接字丢失。

你的守护进程在运行吗?你启动了吗?

如果您希望 lighttpd 启动守护程序,那么您必须在“/device”的 fastcgi.server 设置中包含“bin-path”。见 https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModFastCGI

于 2017-01-26T15:26:54.613 回答