c - 实现 FastCGI++ 库的守护进程的正确 Lighttpd 配置是什么?

标签 c linux lighttpd fastcgi++

(也发布到 FastCGI++-users 邮件列表,但是它在相当长的时间内没有被激活)

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

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

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

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

谢谢,

迈克

cat/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"

最佳答案

"No such file or directory on unix: /tmp/Myapp.sock"

这意味着套接字丢失了。

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

如果你想让 lighttpd 启动守护进程,那么你必须在你的“/device”的 fastcgi.server 设置中包含“bin-path”。看 https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModFastCGI

关于c - 实现 FastCGI++ 库的守护进程的正确 Lighttpd 配置是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41872748/

相关文章:

c++ - 在 Keil 中添加一个库作为在 C 项目中使用 C++ 的外观

c++ - 如何以及何时制作指针拷贝

c++ - libthrift-0.9.1.so : cannot open shared object file: No such file or directory

linux - copy_to_user 在 linux 内核版本 4.12.8 中未定义

javascript - 使用 JavaScript XHR 列出服务器目录

python - Lighttpd + fastcgi + python (for django) 在第一次请求时变慢

c - c中的pow数字错误

c - 使用 ANTLR C 目标,如何使用操作来打印 token ?

python - 如何在 Windows 上挂载和卸载

c - 哪个有更好的代码库可以借鉴: nginx or lighttpd?