Nginx - Treats PHP as binary
- by Think Floyd
We are running Nginx+FastCgi as the backend for our Drupal site.
Everything seems to work like fine, except for this one url.
http:///sites/all/modules/tinymce/tinymce/jscripts/tiny_mce/plugins/smimage/index.php
(We use TinyMCE module in Drupal, and the url above is invoked when
user tries to upload an image)
When we were using Apache, everything was working fine.
However, nginx treats that above url Binary and tries to Download it.
(We've verified that the file pointed out by the url is a valid PHP file)
Any idea what could be wrong here?
I think it's something to do with the NGINX configuration, but not entirely sure what that is.
Any help is greatly appreciated.
Config:
Here's the snippet from the nginx configuration file:
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;
}