Nginx - Treats PHP as binary

Posted by Think Floyd on Stack Overflow See other posts from Stack Overflow or by Think Floyd
Published on 2009-06-24T22:20:49Z Indexed on 2011/01/01 0:53 UTC
Read the original article Hit count: 164

Filed under:
|
|
|
|

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;
       }

© Stack Overflow or respective owner

Related posts about php

Related posts about drupal