我刚安装了舞者,并尝试了一个简短的例子
#!/usr/bin/perl
use Dancer2;
get '/' => sub {
return 'Hello World!';
};
start;
但我似乎没有localhost/cgi-bin/test.pl
的任何输出。
我认为我的lighttpd服务器配置得相当正确,因为如果我用这个替换上面的文本,就会显示页面。
#!/usr/bin/perl
start;
$date = `date`;
$reddit = `curl -L www.google.com`;
print<<END;
<html>
<head>
<h2>Hello</h2>
</head>
<title>
$date
</title>
<body>
$reddit
</body>
</html>
END
但是,如果我使用localhost:3000
,则舞者的脚本会正确显示
这是我的lighttpd.conf文件,我认为我没有太多改变
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
# "mod_rewrite",
)
server.document-root = "/var/www/test"
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
server.chroot = "/"
index-file.names = ( "index.pl", "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 :(得分:0)
来自manual:
使用Lighttpd
你可以使用Lighttp的mod_proxy:
$HTTP["url"] =~ "/application" { proxy.server = ( "/" => ( "application" => ( "host" => "127.0.0.1", "port" => 3000 ) ) ) }
此配置将代理对localhost:3000上路径/的/ application路径的所有请求。