2017-01-26 53 views
0

(也張貼到FastCGI ++ - 用戶郵件列表,但它不是在一段顯著長度很活躍)實現FastCGI ++庫的守護進程的正確Lighttpd配置是什麼?

我目前正在嘗試使用的FastCGI ++(2.1版本)庫我寫的應用程序中。該應用程序將作爲Linux機器上的守護程序運行,並通過lighttpd提供狀態網頁。我打算使用FastCGI ++接口定期自動更新狀態網頁。

我已經加入一個線程來我的應用程序,它創建的FastCGI ++ Manager實例,並且回聲字符串響應任何請求(基本上是一樣的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" 

回答

0

「在UNIX上沒有這樣的文件或目錄:/tmp/Myapp.sock」

這意味着套接字丟失。

你的守護進程在運行嗎?你開始了嗎?

如果要讓lighttpd啓動守護進程,那麼必須在「/ device」的fastcgi.server設置中包含「bin-path」。請參閱 https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModFastCGI

+0

守護程序正在運行。我的印象是,如果lighttpd啓動應用程序,那麼(a)每個請求都會創建一個新實例,並且(b)應用程序只會在請求期間運行。 鑑於守護進程涉及特定硬件設備的監視和控制,我需要它從引導始終運行。 –

+0

您的印象不正確。 lighttpd在啓動時啓動守護進程,並在lighttpd關閉時向它發送一個期限信號。無論lighttpd是否啓動守護進程,lighttpd都會爲每個請求創建一個到FastCGI後端的新套接字連接。如果守護進程正在運行,則應該存在/tmp/Myapp.sock。可以?如果不是,由於「舊」時間戳,cron作業是否將其從/ tmp中移除?也許考慮把套接字放在其他地方? – gstrauss

相關問題