perusio / drupal-with-nginx

Running Drupal using nginx: an idiosyncratically crafted bleeding edge configuration.
854 stars 246 forks source link

IMCE #60

Open ghost opened 12 years ago

ghost commented 12 years ago

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?

perusio commented 12 years ago

Hmm. What's in the logs?

ghost commented 12 years ago

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"

perusio commented 12 years ago

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

ghost commented 12 years ago

Its D6.

Thanks, as always!

LouisStAmour commented 12 years ago

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.

perusio commented 12 years ago

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.

ghost commented 11 years ago

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

Regards,

Al.

ghost commented 11 years ago

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@ckeditorsetFile|&CKEditorFuncNum=' + editor..filebrowserFnIMCE, width, height);

AlexAndrascu commented 10 years ago

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

kkomelin commented 9 years ago

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