nginx和催化剂配置

时间:2012-12-16 04:29:13

标签: perl nginx fastcgi catalyst

我在使用nginx和部署Catalyst应用程序时遇到问题 FastCGI的。我试图在ubuntu 12.04下执行此操作。

我已经成功配置了nginx来提供我的静态内容 app的/ root子目录。但是,当我尝试任何我的动态 网址,我的应用程序错误日志中出现404错误 (未映射)url未找到,这让我相信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和 脚本/ budgetweb_fastcgi.pl同时,因为他们都使用了 相同的插座。所以我猜我只应该使用Catalyst 脚本?此外,运行fcgiwrap时,我收到502“错误的网关”错误 尝试访问静态内容时。

非常感谢任何帮助或指示帮助。到目前为止,我已经查看了以下页面(其中包括; 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;
}

1 个答案:

答案 0 :(得分:0)

Catalyst附带的fastcgi.pl脚本是你的FastCGI包装器。您应该做的就是在套接字上启动它,然后将您的Web服务器指向该套接字,一切都应该通过。您要为生产系统做的唯一事情是创建一个启动/停止脚本,该脚本将在启动和关闭时启动和停止您的应用程序。 start命令看起来非常像你上面运行的那样(你可能想添加一个' -d'标志来守护它。)

在您的网络服务器配置中,配置' /'指向你的申请应该没问题。您可以尝试删除'索引,' try_files'和' fastcgi_index'配置行,可能导致nginx尝试静态地提供内容而不是将请求传递给您的应用程序。

相关问题