Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Here is my nginx (1.1.19) conf for the Silverstripe site. I am using PHP-FPM as well. nginx and PHP-FPM for the most part are vanilla setups at the moment. I am using a separate FPM pool with its own unix socket.

server {
  server_name dev.example.com;
  root /srv/www/example.com/dev;

  index index.php index.html;

  access_log logs/dev.example.com.access.log;
  error_log logs/dev.example.com.error.log;

  location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ {
    expires 7d;
    access_log off;
    access_log off;
    log_not_found off;
  }

  error_page  404  /framework/main.php;

  location / {
    try_files $uri @silverstripe;
  }

  location @silverstripe {
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root/framework/main.php;
    fastcgi_param SCRIPT_NAME /framework/main.php;
    fastcgi_param QUERY_STRING url=$uri&$args;
    fastcgi_buffer_size 32k;
    fastcgi_buffers 4 32k;
    fastcgi_busy_buffers_size 64k;
    fastcgi_pass unix:/var/run/php.fpm.example.sock;
  }                                                                                                                                                                                                                       
}

In the CMS it tries to load the Tiny MCE script (tiny_mce_gzip.php), it is a PHP script that is supposed to return JavaScript. It doesn't though and looks like it is just returning the PHP script as plain text. The request response is just the PHP text which causes the browser to fail because it is trying to interpret it as JavaScript (I think) and gives this error:

Uncaught SyntaxError: Unexpected token < 

The < seems to be the beginning of the opening <?php tag.

I must have something misconfigured for it to do this. Any suggestions? I can provide more info if needed.

share|improve this question
1  
Your @silverstripe location looks very strange. SCRIPT_FILENAME, SCRIPT_NAME etc. seem to be completely wrong. Try setting it up according to the documentation. (Though it has some minor problems, it should at least be functional.) –  Michael Hampton Dec 4 '12 at 20:00
    
@MichaelHampton I copied and pasted their config and now I just get a 404 when it tries to load the tiny_mce_gzip.php file. –  Brandon Dec 4 '12 at 20:12

1 Answer 1

See https://gist.github.com/chtombleson/8703899

` # whitelist php files that are called directly and need to be interpreted location = /framework/thirdparty/tinymce/tiny_mce_gzip.php { include fastcgi_params; fastcgi_pass unix:/var/run/php5-fpm.sock; }

location = /framework/thirdparty/tinymce-spellchecker/rpc.php {
    include fastcgi_params;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.