Nginx的 - 黄柏PHP作为二进制
题
我们正在运行的Nginx + FastCGI的作为后端为我们的Drupal站点。 一切似乎都喜欢精致的工作,除了这一个网址。 HTTP:///sites/all/modules/tinymce/tinymce/jscripts/tiny_mce/plugins/smimage/index.php
(我们使用TinyMCE的模块在Drupal,和上面的URL被调用时 用户尝试上载的图像)
当我们使用Apache,一切工作正常。 然而,nginx的把上面的网址二进制,并尝试下载它。 (我们已经证实,该文件指出,由URL是一个有效的PHP文件)
任何想法可能是错在这里?
我觉得这件事情做的NGINX配置,但并不完全知道那是什么。
任何帮助不胜感激。
配置: 下面是来自nginx的配置文件中的片段:
root /var/www/;
index index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
error_page 404 index.php;
location ~*
\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$
{
deny all;
}
location ~* ^.+\.(jpg|jpeg|gif|png|ico)$ {
access_log off;
expires 7d;
}
location ~* ^.+\.(css|js)$ {
access_log off;
expires 7d;
}
location ~ .php$ {
include /etc/nginx/fcgi.conf;
fastcgi_pass 127.0.0.1:8888;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
}
location ~ /\.ht {
deny all;
}
解决方案
请它
location ~ \.php$ {
代替
的location ~ .php$ {
其他提示
如果说没有做到这一点,还请确保您有FastCGI的端口上运行8888,您可以检查与:
netstat -la | grep :8888
如果你得到的回应你没问题:
tcp 0 0 localhost:9000 *:* LISTEN
或者尝试以下,并寻找哪个端口侦听的:
netstat -la | grep LISTEN
也许PHP文件正在运行,但生成的二进制文件。难道这个脚本生成的图像?很难说没有看到一些配置。
不隶属于 StackOverflow