【发布时间】:2012-12-03 15:09:04
【问题描述】:
我在使用 nginx 部署 Catalyst 应用程序时遇到问题,并且 快速cgi。我试图在 ubuntu 12.04 下执行此操作。
我已成功配置 nginx 以提供来自我的静态内容 应用程序的 /root 子目录。然而,当我尝试任何我的动态 urls,我在应用程序的错误日志中收到 404 错误,说 (unmapped) url is not found,这让我相信 nginx 是 尝试提供类似于静态页面的请求,而不是 将其发送到我的 Catalyst 应用程序。
要重申,点击“localhost:3001/root/static.html”会导致 静态内容在浏览器中成功显示,但是 点击 'localhost:30001/expense/editor' 会导致以下错误:
"GET /expense/editor HTTP/1.1" 404
(其中 '/expense/editor' 是我的应用程序中的一条路径,我可以 运行内置 Catalyst 开发时成功访问 服务器)。
我正在启动 Catalyst 应用程序:
> perl script/budgetweb_fastcgi.pl -l localhost:3003
我也尝试过运行 /etc/init.d/fcgiwarp。我不清楚是否需要运行 单独的 fastcgi 包装器,或者如果上面的 perl 脚本 是 我的 fastcgi 包装。我编辑了 fcgiwrap 以使用 TCP 套接字 (127.0.0.1:3003),它 然后阻止我同时运行 /etc/init.d/fcgiwrap 和 script/budgetweb_fastcgi.pl 同时使用,因为它们都使用 同一个插座。所以我猜我应该只使用催化剂 脚本?此外,在运行 fcgiwrap 时,我收到 502“bad gateway”错误 尝试访问静态内容时。
任何帮助或帮助指针,将不胜感激。到目前为止,我已经查看了以下页面(其中包括;StackOverflow 只允许我发布两个链接):
Catalyst wiki
HOWTO: Deploy a Catalyst application using FastCGI and nginx
这是我的服务器 nginx 配置文件:
server {
listen 3001;
server_name budgetweb.com;
root /local/www/money/budgetweb;
location /root {
add_header Cache-control public;
root /local/www/money/budgetweb/;
}
location / {
access_log /local/www/money/budgetweb/logs/access.log;
error_log /local/www/money/budgetweb/logs/error.log;
index index.html index.htm index.pl;
try_files $uri =404;
gzip off;
fastcgi_pass localhost:3003;
fastcgi_index index.pl;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /local/www/money/budgetweb$fastcgi_script_name;
fastcgi_param SCRIPT_NAME /;
fastcgi_param PATH_INFO $fastcgi_script_name;
}
# Disable gzip (it makes scripts feel slower since they have to complete
# before getting gzipped)
gzip off;
# include /etc/nginx/fcgiwrap.conf;
}
【问题讨论】:
标签: perl nginx fastcgi catalyst