Honestly I did a search but so many results came up saying different things I figured a new topic wouldn't be that bad.

I've muddled through my first drupal setup using Nginx but I don't think it's set right it works but it is a bit slow and some things that don't work on the site point to Nginx being the problem.

So I want advice for setting up Nginx.

All comments welcome as always :) below is what I am currently using for a site I plan to set up 4 more sites this month so I could do with getting it optimised.

server {
        client_max_body_size 20M;
listen          80;

location / {
                        index  index.html index.htm index.php;
                        error_page 404 = @drupal;
}

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

location ~ \.php$ {
        fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        include fastcgi.conf;
}
        }

Comments

John_B’s picture

I doubt if the slowness is related to the nginx config. You should look at the php5-fpm error log to see whether there are any indications there why the site is slow. However, what reason do you have for thinking the slowness is related to server setup (rather than something about the site, or the hardware on your server, for example?). Is the site any quicker if you stop nginx and start Apache on port 80 and run the site that way? If not, then why would you suspect nginx?

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors