Debian 设置lighttpd+;werc,CGI无法运行rc脚本?

Debian 设置lighttpd+;werc,CGI无法运行rc脚本?,debian,cgi,lighttpd,plan-9,Debian,Cgi,Lighttpd,Plan 9,我第一次在我的新VPS上设置了一个web堆栈。我的目标是Debian Jessie+lighttpd+werc werc是一个运行在rc(从Plan9移植到Linux的非标准shell)上的简单框架。有一些教程可以让它在lighttpd上工作: 不幸的是,跟随他们是不成功的,我已经开始了从基本CGI开始的构建过程。我成功地让CGI使用sh脚本,但当我试图让CGI使用rc时遇到了麻烦。我做了一些工作来隔离这个问题,而lighttpd似乎根本不会运行rc脚本。我很确定这不是权限或路径问题;见下文

我第一次在我的新VPS上设置了一个web堆栈。我的目标是Debian Jessie+lighttpd+werc

werc是一个运行在rc(从Plan9移植到Linux的非标准shell)上的简单框架。有一些教程可以让它在lighttpd上工作:

不幸的是,跟随他们是不成功的,我已经开始了从基本CGI开始的构建过程。我成功地让CGI使用sh脚本,但当我试图让CGI使用rc时遇到了麻烦。我做了一些工作来隔离这个问题,而lighttpd似乎根本不会运行rc脚本。我很确定这不是权限或路径问题;见下文

要总结我的设置,请执行以下操作:

  • 清洁Debian 8.0 Jessie安装
  • 已安装lighttpd debian软件包
  • 安装9base-6以获得rc外壳()
  • 轻启动模块cgi
  • 在/var/www/html/cgi-bin/(见下文)中编写test.sh和test.rc脚本
  • 制作一个
    /newbin
    目录并将sh和rc的副本放入
  • 编辑
    /etc/lighttpd/conf enabled/10 cgi.conf
    以使用我在
    /newbin
    中的新副本处理.sh和.rc文件
  • 为了澄清,第6步是隔离问题,因此我知道这不是路径问题

    下面是一个shell会话,显示我的设置的所有组件,并记录我的问题:

    root@x220-jessie:~# cat /etc/lighttpd/lighttpd.conf 
    server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
    #       "mod_rewrite",
    )
    
    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
    
    
    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"
    
    root@x220-jessie:~# cat /etc/lighttpd/conf-enabled/10-cgi.conf 
    # /usr/share/doc/lighttpd/cgi.txt
    
    server.modules += ( "mod_cgi" )
    
    $HTTP["url"] =~ "^/cgi-bin/" {
        cgi.assign = ( ".rc" => "/newbin/rc" )
        cgi.assign += ( ".sh" => "/newbin/sh" )
    }
    
    root@x220-jessie:~# ls -l /newbin
    total 1128
    -rwxr-xr-x 1 root root 1024920 Jul 13 12:07 rc
    -rwxr-xr-x 1 root root  125400 Jul 13 12:11 sh
    root@x220-jessie:~# cat /var/www/html/cgi-bin/test.sh
    #!/bin/sh
    echo 'Content-Type: text/plain'
    echo
    echo 'This is a sh program!'
    root@x220-jessie:~# cat /var/www/html/cgi-bin/test.rc
    #!/newbin/rc
    echo 'Content-Type: text/plain'
    echo
    echo 'This is a rc program!'
    root@x220-jessie:~# /var/www/html/cgi-bin/test.sh
    Content-Type: text/plain
    
    This is a sh program!
    root@x220-jessie:~# /var/www/html/cgi-bin/test.rc
    Content-Type: text/plain
    
    This is a rc program!
    root@x220-jessie:~# /etc/init.d/lighttpd force-reload
    [ ok ] Reloading lighttpd configuration (via systemctl): lighttpd.service.
    root@x220-jessie:~# curl localhost | tail
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  3373  100  3373    0     0   872k      0 --:--:-- --:--:-- --:--:-- 1097k
      </p>
      <p>
       If you find a bug in this Lighttpd package, or in Lighttpd itself, please file a bug report on it. Instructions on doing this, and the list of known bugs of this package, can be found in the 
       <a href="http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=lighttpd">Debian Bug Tracking System.</a>
      </p>
     </div>
    </div>
    <!-- s:853e9a42efca88ae0dd1a83aeb215047 -->
    </body>
    </html>
    root@x220-jessie:~# curl localhost/cgi-bin/test.sh
    This is a sh program!
    root@x220-jessie:~# curl localhost/cgi-bin/test.rc
    <?xml version="1.0" encoding="iso-8859-1"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
     <head>
      <title>500 - Internal Server Error</title>
     </head>
     <body>
      <h1>500 - Internal Server Error</h1>
     </body>
    </html>
    root@x220-jessie:~# tail /var/log/lighttpd/error.log 
    2015-07-13 12:48:40: (server.c.1558) server stopped by UID = 0 PID = 1 
    2015-07-13 12:51:14: (log.c.164) server started 
    2015-07-13 12:51:47: (server.c.1558) server stopped by UID = 0 PID = 1 
    2015-07-13 12:52:17: (log.c.164) server started 
    2015-07-13 12:52:31: (server.c.1558) server stopped by UID = 0 PID = 1 
    2015-07-13 12:52:42: (log.c.164) server started 
    2015-07-13 12:55:08: (server.c.1558) server stopped by UID = 0 PID = 1 
    2015-07-13 15:23:49: (log.c.164) server started 
    2015-07-13 15:25:49: (server.c.1558) server stopped by UID = 0 PID = 1 
    2015-07-13 15:25:50: (log.c.164) server started 
    root@x220-jessie:~# 
    
    root@x220-杰西:cat/etc/lighttpd/lighttpd.conf
    server.modules=(
    “mod_访问”,
    “mod_别名”,
    “mod_compress”,
    “mod_重定向”,
    #“修改”,
    )
    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
    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=(“应用程序/javascript”、“文本/css”、“文本/html”、“文本/plain”)
    #IPv6的默认侦听端口退回到IPv4端口
    包括_shell“/usr/share/lighttpd/use-ipv6.pl”+server.port
    包括_shell“/usr/share/lighttpd/create mime.assign.pl”
    include_shell“/usr/share/lighttpd/include conf enabled.pl”
    root@x220-杰西:~#cat/etc/lighttpd/conf enabled/10-cgi.conf
    #/usr/share/doc/lighttpd/cgi.txt
    server.modules+=(“mod_cgi”)
    $HTTP[“url”]=~“^/cgi-bin/”{
    cgi.assign=(“.rc”=>”/newbin/rc”)
    cgi.assign+=(“.sh”=>“/newbin/sh”)
    }
    root@x220-杰西:ls-l/纽宾
    总数1128
    -rwxr-xr-x 1根根目录1024920 Jul 13 12:07 rc
    -rwxr-xr-x 1根根125400七月13日12:11上海
    root@x220-杰西:cat/var/www/html/cgi-bin/test.sh
    #!/垃圾箱/垃圾箱
    回显“内容类型:文本/普通”
    回声
    echo“这是一个sh程序!”
    root@x220-杰西:cat/var/www/html/cgi-bin/test.rc
    #!/纽宾/rc
    回显“内容类型:文本/普通”
    回声
    echo“这是一个rc程序!”
    root@x220-杰西:~#/var/www/html/cgi-bin/test.sh
    内容类型:文本/纯文本
    这是一个sh程序!
    root@x220-杰西:~#/var/www/html/cgi-bin/test.rc
    内容类型:文本/纯文本
    这是一个rc程序!
    root@x220-杰西:~#/etc/init.d/lighttpd强制重新加载
    [确定]重新加载lighttpd配置(通过systemctl):lighttpd.service。
    root@x220-杰西:~#卷曲本地主机|尾巴
    %总接收百分比%x平均速度时间电流
    数据加载上载总左速度
    100 3373 100 3373 0 0 872k 0--:---:---:---:---1097k
    

    如果您在此Lighttpd包中或Lighttpd本身中发现错误,请提交错误报告。有关执行此操作的说明以及此软件包的已知错误列表,请参见

    root@x220-杰西:~#curl localhost/cgi-bin/test.sh 这是一个sh程序! root@x220-杰西:~#curl localhost/cgi-bin/test.rc 500-内部服务器错误 500-内部服务器错误 root@x220-杰西:~#tail/var/log/lighttpd/error.log 2015-07-13 12:48:40:(server.c.1558)服务器被UID=0 PID=1停止 2015-07-13 12:51:14:(log.c.164)服务器已启动 2015-07-13 12:51:47:(server.c.1558)服务器被UID=0 PID=1停止 2015-07-13 12:52:17:(log.c.164)服务器已启动 2015-07-13 12:52:31:(server.c.1558)服务器被UID=0 PID=1停止 2015-07-13 12:52:42:(log.c.164)服务器已启动 2015-07-13 12:55:08:(server.c.1558)服务器被UID=0 PID=1停止 2015-07-13 15:23:49:(log.c.164)服务器已启动 2015-07-13 15:25:49:(server.c.1558)服务器被UID=0 PID=1停止 2015-07-13 15:25:50:(log.c.164)服务器已启动 root@x220-杰西:~#
    我在运行Debian 8.0的VPS、运行Debian 8.0的笔记本电脑和运行Debian 7.8的笔记本电脑上遇到了同样的问题

    我试图通过启动调试来进一步跟踪问题,但
    server.modules+=(“mod_debug”)
    导致lighttpd失败。如果有人对如何启动调试有建议,那也会有帮助。另外,如果有人碰巧尝试了这一点,并成功地在Debian 8.0上运行了werc,我很乐意听到这个消息

    非常感谢