drupal-with-nginx icon indicating copy to clipboard operation
drupal-with-nginx copied to clipboard

IMCE

Open ghost opened this issue 13 years ago • 10 comments
trafficstars

Hi,

We have added IMCE image editor module for the wysiwyg editor, however when I click on "browse server" when adding an image NginX gives an error because php files are not allowed. Can I create a new location to make this work? The image browser window is attempting to load the URL:

index.php?q=imce&app=ckeditor|sendto@ckeditor_fileUrl|&CKEditor=edit-body&CKEditorFuncNum=1&langCode=en

However as .php files are blocked with your drupal/nginx/boost config and clean URLS are on, it gives a 404 error.

Any thoughts?

ghost avatar Aug 03 '12 12:08 ghost

Hmm. What's in the logs?

perusio avatar Aug 07 '12 20:08 perusio

Using your config verbatim I get a 404 when attempting to "browse" the images from within the editor.. the browser pop up that should browse the images has the following in URL bar:

www.site.com/index.php?q=imce&app=ckeditor|sendto@ckeditor_fileUrl|&CKEditor=edit-body&CKEditorFuncNum=1&langCode=en

and the webpage shows a 404

When I allow access to index.php by hashing out "internal" as below

location = /index.php { ## This is marked internal ## http://wiki.nginx.org/HttpCoreModule#internal as pro-active ## security practice. No direct access to index.php is allowed all ## accesses are made by Nginx from other locations or internal ## redirect. ## internal; fastcgi_pass phpcgi;

Then I get a bad gateway, timeout:

2012/08/08 09:19:03 [error] 21514#0: *1005 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: x.x.x.x, server: www.site.com, request: "GET /imce?app=ckeditor%7Csendto%40ckeditor_fileUrl%7C&CKEditor=edit-body&CKEditorFuncNum=1&langCode=en HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "www.site.com", referrer: "http://www.site.com/node/177107/edit"

ghost avatar Aug 08 '12 08:08 ghost

I have to look into it. Is this a D7 or D6 site?

perusio avatar Aug 08 '12 09:08 perusio

Its D6.

Thanks, as always!

ghost avatar Aug 08 '12 09:08 ghost

If this is still a bug in the stock drupal-with-nginx config, I've gotten IMCE working on my end with internal (above) commented out. My PHP setup is a bit different than the normal one, however, as I kept having issues running a heavily customized drupal under Nginx instead of Apache.

An alternative is to grep the source code of imce and replace index.php?q= mentions in one of the files, which I've also done on one of my deploys, though it makes updating more fun.

LouisStAmour avatar Aug 23 '12 16:08 LouisStAmour

Hmm, The internal keyword only forbids direct access. This means that somewhere IMCE makes a direct request to index.php. I'll open up an issue in that project issue queue.I think that's the more sensible thing to do. Thx.

perusio avatar Aug 30 '12 07:08 perusio

Hi thanks for doing this. Did they come back to your issue?

Regards,

Al.

ghost avatar Jan 23 '13 14:01 ghost

If it helps I found the following in /sites/all/modules/ckeditor/plugins/imce/plugins.js

editor.popup(Drupal.settings.basePath + 'index.php?q=imce\x26app=ckeditor|sendto@ckeditor_setFile|&CKEditorFuncNum=' + editor._.filebrowserFnIMCE, width, height);

ghost avatar Jan 23 '13 17:01 ghost

I'm interested in this too. Antonio have you managed to open up an issue ? Can you please link back to it so we can subscribe to that?

Thank you, Alex

AlexAndrascu avatar Oct 23 '13 09:10 AlexAndrascu

The problem is still relevant, even nowadays. I don't understand why CKE needs direct access to index.php

kkomelin avatar Nov 09 '14 19:11 kkomelin