我试图让一个C :: A应用程序在Nginx fastcgi环境(debian 6.0)中运行并使用spawn-fcgi.
使用$self-> mode_param(path_info => 1,param =>’rm’)配置C :: A路由;
问题是,无论我要求的C :: A应用程序网址(example.com/cities,example.com/profile/99等),它总是显示example.com/index.pl所做的主页.
我的Nginx设置是
server { listen 80; server_name example.com; root /var/www/example.com/htdocs; index index.pl index.html; location / { try_files $uri $uri/ /index.pl; } location ~ .*\.pl${ include fastcgi_params; # this is the stock fastcgi_params file supplied in debian 6.0 fastcgi_index index.pl; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PERL5LIB "/var/www/example.com/lib"; fastcgi_param CGIAPP_CONfig_FILE "/var/www/example.com/conf/my.conf"; fastcgi_pass unix:/var/run/fcgiwrap.socket; } }
我已经以类似的方式成功设置了几个PHP应用程序.
但是,在这种情况下,我怀疑我没有将必要的fastcgi_param传递给C :: A,这是它所要求的.
你的想法是什么?
解决方法
我维护CGI :: Application并使用Nginx.我没有做同样的事情,但我会试试这个:
fastcgi_split_path_info ^(/index.pl)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_NAME $fastcgi_script_name;
这应该捕获并转发您需要的PATH_INFO.
参考文献:
> Offical Nginx FastCGI docs
> Related blog post with example这不适用于CGI :: App,但我认为它足够接近有用.