Drupal on [nginx-based] DotCloud instances

Events happening in the community are now at Drupal community events on www.drupal.org.
thebuckst0p's picture

I wrote a blog post about getting Drupal to work on an automated DotCloud instance. The main pain point I ran into was configuring the rewrite rules for nginx, so maybe this group can help.

DotCloud allows an nginx.conf file in a project root, which the server picks up when it reloads. I based mine on perusio's drupal-with-nginx project, specifically the drupal.conf and drupal7.conf files. (I tried it with both D6 and D7 and had the same issue.)

Problem in a nutshell is, none of the rewrite rules are working properly. I know the file is being picked up, because if I out in obviously wrong syntax, the logs show an error, but the good directives aren't working properly. I've stripped it down to its simplest variation:

location @drupal {
    rewrite ^/(.*)$ /index.php?q=$1 last;
}

but it throws a generic nginx 404 on every URL (except index.php?q=X).

Has anyone tried to deploy on dotcloud? Any suggestions for how to debug the conf?

Thanks!

Comments

Hello from DotCloud

shad42's picture

Hi,

I work for DotCloud, I am pretty sure I can help you on this. Would you mind to forward this on support 'at' dotcloud.com to do the follow-up (including your deployment name)? After we fixed your problem, you could post the fix on this page.

What do you think?

  • Sam

Hmm: that's strange

perusio's picture

You can try to see what's going on by looking at the logs: the error and access logs. Could be something related with the path. I'm using exact locations now.

Note that there's only one entry point in nginx for the config. It requires a SIGHUP to reread the config and it stays there until a new SIGHUP or more drastic things.

Post the URI it receives and you see in the error log.

Thanks Sam, I have an ongoing

thebuckst0p's picture

Thanks Sam, I have an ongoing thread on dotcloud support with Jérôme Petazzoni (http://support.dotcloud.com/requests/9301), he suggested try_files $uri $uri/ /index.php; which "worked," but not for Drupal.

I'm running a dotcloud restart on the instance after every push, I assume that's the SIGHUP perusio is referring to. There's a deployment bug with dotcloud push from Git, though, which I've reported in another thread.

Should I post here in parallel or stick to one channel?

Thanks

It's better for you if you

shad42's picture

It's better for you if you stick to the DotCloud support as soon as you find a workaround for your problem, then post it here for everyone :-)

The best they suggested was

thebuckst0p's picture

The best they suggested was reducing the nginx.conf file to one line:

try_files $uri $uri/ /index.php?q=$uri;

And that does in fact work. However, it leaves out all the other rules in the perusio's configs, and they haven't replied yet about how to deal with those.

So altogether I'm not sure this is a good strategy for Drupal. I'll update my blog post with this info as well.

Try it again

perusio's picture

I've updated the config and removed all rewrites. Unless you're using spaces or any other module that relies on purl, meaning doing funny stuff with custom_url_rewrite_outbound (D6 only) you should be able to get by without any rewrite whatsoever.

Try it.

Nginx

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: