我正在使用 mailman 和 nginx 来获取它的 web 界面这是我的 nginx 配置:
location /cgi-bin/mailman {
root /usr/lib/;
fastcgi_split_path_info (/cgi-bin/mailman[^/]*)/(.*)$;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $fastcgi_path_info;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
当我调用时它似乎工作得很好mydomain.com/cgi-bin/mailman/listinfo
,但是当我请求类似的内容时:mydomain.com/cgi-bin/mailman/listinfo/mylist
我得到了403
并在 nginx 错误日志中:
FastCGI sent in stderr: "Cannot chdir to script directory (/usr/lib/cgi-bin/mailman/listinfo)" while reading response header from upstream
我尝试了所有可用的正则表达式来使其工作,但它仍然没有提供403
任何帮助或任何线索来使其工作。
答案1
我也遇到了同样的问题。我在某处找到了解决方案:只需注释掉
fastcgi_param SCRIPT_FILENAME $request_filename;
行/etc/nginx/fastcgi_params
。它可以工作,但我认为最好不要注释掉此行,只需交换包含此文件和定义您自己的 SCRIPT_FILENAME 的顺序:
location /cgi-bin/mailman {
root /usr/lib/;
fastcgi_split_path_info (/cgi-bin/mailman[^/]*)/(.*)$;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
include /etc/nginx/fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $fastcgi_path_info;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/fcgiwrap.socket; }
现在它对我有用。