我有一个在Linux上运行的Nginx / php服务器,并成功使用广泛使用的cgi-bin.php script来运行awstats。
切换回Windows并正确配置Nginx,Php并安装Strawberry Perl后,脚本将无法运行,只是说“找不到页面”。
我意识到这是由php脚本中的is_executable
开关引起的,但如果我删除了开关,请求将在那里做任何事情,直到php超时,给出504错误。
这是我的nginx conf文件的一部分,用于执行cgi-bin文件夹(php-cgi正在侦听127.0.0.1:9000)
# Configure /cgi-bin/scripts to go through php-fastcgi
location ~ ^/cgi-bin/.*\.(cgi|pl|py|rb) {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index cgi-bin.php;
fastcgi_param SCRIPT_FILENAME C:/wemp/cgi-bin.php;
fastcgi_param SCRIPT_NAME /cgi-bin/cgi-bin.php;
fastcgi_param X_SCRIPT_FILENAME C:/wemp/cgi-bin$fastcgi_script_name;
fastcgi_param X_SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REMOTE_USER $remote_user;
#fastcgi_param QUERY_STRING $query_string;
#fastcgi_param REQUEST_METHOD $request_method;
#fastcgi_param CONTENT_TYPE $content_type;
#fastcgi_param CONTENT_LENGTH $content_length;
#fastcgi_param GATEWAY_INTERFACE CGI/1.1;
#fastcgi_param SERVER_SOFTWARE nginx;
#fastcgi_param REQUEST_URI $request_uri;
#fastcgi_param DOCUMENT_URI $document_uri;
#fastcgi_param DOCUMENT_ROOT $document_root;
#fastcgi_param SERVER_PROTOCOL $server_protocol;
#fastcgi_param REMOTE_ADDR $remote_addr;
#fastcgi_param REMOTE_PORT $remote_port;
#fastcgi_param SERVER_ADDR $server_addr;
#fastcgi_param SERVER_PORT $server_port;
#fastcgi_param SERVER_NAME $server_name;
}