python-3.x - 无法启动 lig​​httpd 服务守护进程

标签 python-3.x ubuntu flask lighttpd

我想在我的远程 ubuntu 服务器上设置 lighttpd 并启动 flask 应用程序,但是当我使用 systemctl restart lighttpd 时遇到了一些麻烦

这是错误日志:

systemctl 状态 lighttpd

● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2019-01-15 14:31:38 UTC; 3s ago
  Process: 19104 ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf (code=exited, status=255)
  Process: 19097 ExecStartPre=/usr/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 19104 (code=exited, status=255)

Jan 15 14:31:38 ubuntu systemd[1]: Starting Lighttpd Daemon...
Jan 15 14:31:38 ubuntu lighttpd[19097]: Syntax OK
Jan 15 14:31:38 ubuntu systemd[1]: Started Lighttpd Daemon.
Jan 15 14:31:38 ubuntu systemd[1]: lighttpd.service: Main process exited, code=exited, status=255/n/a
Jan 15 14:31:38 ubuntu systemd[1]: lighttpd.service: Unit entered failed state.
Jan 15 14:31:38 ubuntu systemd[1]: lighttpd.service: Failed with result 'exit-code'.


尾/var/log/lighttpd/error.log
2019-01-15 14:31:38: (log.c.164) server started
2019-01-15 14:31:38: (mod_fastcgi.c.1112) the fastcgi-backend /var/www/landing/landing.fcgi failed to start:
2019-01-15 14:31:38: (mod_fastcgi.c.1116) child exited with status 8 /var/www/landing/landing.fcgi
2019-01-15 14:31:38: (mod_fastcgi.c.1119) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.
If this is PHP on Gentoo, add 'fastcgi' to the USE flags.
2019-01-15 14:31:38: (mod_fastcgi.c.1406) [ERROR]: spawning fcgi failed.

这是我的 lighttpd.conf

猫/etc/lighttpd/lighttpd.conf
server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
        "mod_rewrite",
        "mod_fastcgi",
)

server.document-root        = "/var/www/"
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

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" )

include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

fastcgi.server = (
    "/" =>
    ((
        "socket" => "/tmp/landing-fcgi.sock",
        "bin-path" => "/var/www/landing/landing.fcgi",
        "check-local" => "disable",
        "max-procs" => 1
    ))
)

alias.url = (
    "/static/" => "/var/www/landing/static/",
)

url.rewrite-once = (
    "^(/static($|/.*))$" => "$1",
    "^(/.*)$" => "/landing.fcgi$1"
)

还有我的landing.fcgi
from flup.server.fcgi import WSGISerever
import app

if __name__ == '__main__':
    WSGIServer(app, bindAddress='/tmp/landing-fcgi.sock').run()

最佳答案

解决方案:我发现非常好的 python script为 flask 应用程序生成骨架并创建基本的 lighttpd 配置。

它对我很有效,除了我与 flup 有冲突。图书馆。

我安装了flup==1.0.3.dev-20110405版本和更改 python3翻译到 python2口译员
在我的*.fcgi文件。

我想说的另一件事是我删除了118字符串:
input("Press enter to continue (if everything is okay)...")因为由于某种原因我有一个异常(exception)。

希望我的回答对某人有所帮助。

关于python-3.x - 无法启动 lig​​httpd 服务守护进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54201431/

相关文章:

Python prime 列表重复错误

python - 在 Django 中集成其他 Python 应用

python - yield 中的合并排序函数出错

azure - 尝试在 ubuntu 上运行 "az login"时出现 Python 异常和权限被拒绝异常

node.js - NodeJS TCP socket 经常监听 END 事件

python - 如何在 Flask 上捕获这样的异常?

python - 循环修改 OpenGL 小部件的按键输入

mysql - 如何解决 XAMPP 1.7.7 - PHPMyAdmin - Ubuntu 中的 MySQL 错误 #2002

mysql - 如何使用Explain命令使用Python连接Mysql?

python - Flask:flask 在 conda 环境中运行不工作 - Windows、Python 3.8 和 conda 4.7.12