标签: lighttpd

lighttpd运行lua脚本时遇到问题

我一直在尝试在lighttpd中运行lua脚本.我正在运行gentoo,我使用lua use标志安装了lighttpd.mod_magnet.so应该是它应该的位置.当我尝试启动服务器时,我收到此错误:

2011-06-03 15:55:32: (configfile.c.912) source: /etc/lighttpd/lighttpd.conf line: 43 pos: 68 parser failed somehow near here: (
Run Code Online (Sandbox Code Playgroud)

这是我的配置文件:

###############################################################################
# Default lighttpd.conf for Gentoo.
# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/conf/lighttpd.conf,v 1.5     2010/11/18 15:13:47 hwoarang Exp $
###############################################################################

# {{{ variables
var.basedir  = "/var/www/localhost"
var.logdir   = "/var/log/lighttpd"
var.statedir = "/var/lib/lighttpd"
# }}}

# {{{ modules
# At the very least, mod_access and mod_accesslog should be enabled.
# All other modules should only be loaded if necessary.
# NOTE: the order of modules is important. …
Run Code Online (Sandbox Code Playgroud)

lua lighttpd gentoo

0
推荐指数
1
解决办法
2260
查看次数

为什么 PWD 为空以及如何解决?

我正在使用 lighttpd 并编写了以下 cgi 脚本:

main(){
    printf("Content-type: text/html\n\n");
    char * pwd ="";
    pwd=getenv("PWD");
    printf ("The current path is: %s",pwd);
}
Run Code Online (Sandbox Code Playgroud)

结果是

The current path is: (null)
Run Code Online (Sandbox Code Playgroud)

嗯,我不明白为什么。而且我不知道如何找到执行脚本的路径。我正在寻找带有路径的 args[0],并为此使用了 pwd,但也许我应该切换到不同的东西。

更新

不工作也是

char cwd[_PC_PATH_MAX+1];
getcwd(cwd, _PC_PATH_MAX+1);
Run Code Online (Sandbox Code Playgroud)

cwd 是“”。如果我停止使用房间 1408 作为我的数据中心,我的脚本可能知道它在哪里。:P

c cgi lighttpd

0
推荐指数
1
解决办法
523
查看次数

将en.example.com重定向到example.com/index.php?language=en

我想重定向以以下内容开头的地址:

en.example.com/somefile.php
Run Code Online (Sandbox Code Playgroud)

至:

example.com/somefile.php?language=en
Run Code Online (Sandbox Code Playgroud)

在lighttpd中使用mod_rewrite模块.到现在为止我得到了这个:

$HTTP["host"] =~ "^en\.(.*)\.com$" {
        url.rewrite-once = (
                "^/(.*)"
                =>
                "/$1?language=en"
        )
}
Run Code Online (Sandbox Code Playgroud)

但这似乎并没有起作用.该怎么做才能使这项工作?

mod-rewrite multilingual lighttpd

-1
推荐指数
1
解决办法
687
查看次数

为什么getenv("QUERY_STRING")在FastCGI C++程序中返回null?

所以我使用Light HTTPd编写了一个用C++编写的FastCGI应用程序,但是我无法使用它来检索查询字符串getenv("QUERY_STRING").如果我取出查询字符串请求(或添加一个null的检查),一切正常,但有了它,它失败了:

#include <stdlib.h>
#ifdef _WIN32
#include <process.h>
#else
#include <unistd.h>
extern char ** environ;
#endif

#include "fcgio.h"
#include "fcgi_config.h"  // HAVE_IOSTREAM_WITHASSIGN_STREAMBUF
#include "redisclient.h"
Run Code Online (Sandbox Code Playgroud)

....

 while (FCGX_Accept_r(&request) == 0)
 {        
    fcgi_streambuf cin_fcgi_streambuf(request.in);
    fcgi_streambuf cout_fcgi_streambuf(request.out);
    fcgi_streambuf cerr_fcgi_streambuf(request.err);
Run Code Online (Sandbox Code Playgroud)

...

    cout << "Content-type: text/html\r\n"
                "\r\n"
                "<TITLE>^_^</TITLE>\n"
                "<H1>echo-cfpp</H1>\n"
                "<H4>PID: " << pid << "</H4>\n"
                "<H4>Request Number: " << ++count << "</H4>\n";

    // If I make this conditional on getenv("QUERY_STRING") not returning null,
    // then the program behaves reliably.
    cout <<getenv("QUERY_STRING");
 }
Run Code Online (Sandbox Code Playgroud)

我已经验证我在请求中传递了一个查询字符串,那么为什么getenv("QUERY_STRING")返回null?我 …

c++ fastcgi lighttpd

-3
推荐指数
1
解决办法
4879
查看次数

标签 统计

lighttpd ×4

c ×1

c++ ×1

cgi ×1

fastcgi ×1

gentoo ×1

lua ×1

mod-rewrite ×1

multilingual ×1