Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Installing SilverStripe

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Nginx and tiny_mce_gzip.php issues!


Reply

4 Posts   782 Views

Avatar
mrsteveheyes

2 July 2013 at 5:19am Community Member, 15 Posts

Hi there,

I am having real problems with Silverstripe, NGINX and tiny_mce_gzip.php. I have Silverstripe cms and framework "3.0.*@stable" installed. I am running PHP-FPM (PHP 5.3.10-1ubuntu3.6) and NGINX (v1.1.19) on Ubuntu 12.04.2 LTS. I have successfully installed the CMS etc fine and can access the front end and the back end.

However, when I log into the backend admin section, and click on a page to edit, the tiny_mce_gzip.php doesn't load.

Failed to load resource: the server responded with a status of 404 (Not Found) http://datalink.dev/framework/thirdparty/tinymce/tiny_mce_gzip.php&js=1&plu…lscreen,inlinepopups&themes=advanced&languages=en&diskcache=true&src=false

This means that none of the Javascript will work on the page edit page, thus I can't change any template, add content etc.

My nginx conf file is:

server {
server_name datalink.dev static.datalink.dev www.datalink.dev;
access_log /var/log/nginx/datalink_dev_access.log;
error_log /var/log/nginx/datalink_dev_error.log debug;
root /srv/nginx/datalink/dev/public/;

include /etc/nginx/nocrawl.conf;

include /etc/nginx/common.conf;

location / {
try_files $uri @silverstripe;
#if_modified_since off;
}

location ~ ^/framework/.*(rpc|tiny_mce_gzip)\.php$ {
include /etc/nginx/fastcgi_params;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
}

location @silverstripe {
include /etc/nginx/fastcgi_params;

fastcgi_split_path_info ^(.+\.php)(/.+)$;

fastcgi_param SCRIPT_FILENAME $document_root/framework/main.php;
fastcgi_param SCRIPT_NAME /framework/main.php;
fastcgi_param QUERY_STRING url=$uri&$args;

fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
}

location ~ /\.ht {
deny all;
}

location ~ ^/silverstripe-cache {
deny all;
}

location ^~ /assets/ {
try_files $uri $uri/ =404;
# access_log off;
# log_not_found off;
# expires 7d;
#add_header Pragma public;
# add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

location ~ \.ymal {
deny all;
}

location ~ ^/(cms|framework|mysite)/.*\.(php|php[345]|phtml|inc)$ {
deny all;
}

location ~ ^/(cms|framework)/silverstripe_version$ {
deny all;
}

location ~ ^/framework/.*(main|static-main|rpc|tiny_mce_gzip)\.php$ {
allow all;
}
}

Has anyone encountered this problem before? Does anyone know how to stop it? Can anyone see what I have done wrong!?!

Really appreciate it because I have spent hours trying to figure it out and I am just stumped!

Avatar
Bam

12 September 2013 at 1:08pm Community Member, 16 Posts

Hi Steve

I have the same problem. Did you ever have any luck?

Cheers
Sam

Avatar
Bam

12 September 2013 at 1:27pm Community Member, 16 Posts

Got it sorted now. No amount of restarting nginx was fixing it. Rebooted server and now it works. Very strange! If you are still having troubles I can post my configs.

Avatar
Sean

12 September 2013 at 2:05pm (Last edited: 12 September 2013 2:07pm), Forum Moderator, 921 Posts

I initially had problems with tiny_mce_gzip.php, but it was caused by the PHP configuration not setup correctly. normal php extensions wouldn't be served at all (404s), but SilverStripe requests were fine... turns out my location ~ \.php$ directive was broken.

I've written a [url=http://halkyon.net/blog/nginx-php-fpm-and-silverstripe-installation-on-fedora-19/]blog post[/url] about setting it up nginx with PHP-FPM. Fedora/RHEL Linux specific, but the same sort of thing can be applied to other flavours of Linux. In this case I split up the php and silverstripe into separate configs and applied it per-virtualhost, might be a bit tidier especially for environments with multiple sites.

Sean