Nginx

Events happening in the community are now at Drupal community events on www.drupal.org.

This group is dedicated to share experiences on using Nginx as a webserver for Drupal sites. The goal is to provide community powered support for anyone looking for Nginx related advice, configuration examples and tuning. This group was born from a long thread about Nginx and Boost integration.

Nginx for Drupal configuration projects/examples:
Barracuda Aegir by omega8cc (Drupal.org)
Boost compatible by yhager (GitHub)
Idiosyncratic bleeding edge config by perusio (GitHub)

Please file issues, post patches and improvements for projects hosted on GitHub on the GitHub issue tracker.

brianmercer's picture

Google Pagespeed module for nginx

A couple weeks ago a Google Pagespeed module for nginx was released as beta. It has some interesting filters that process things like css files, js files, images, html and headers. See https://developers.google.com/speed/docs/mod_pagespeed/filters

I added it to a test version of my Ubuntu 12.04 nginx package on Launchpad. You can install it with

add-apt-repository ppa:brianmercer/testing
aptitude update
aptitude install nginx-pagespeed

then create a directory for it (I'll do this in the package eventually)

mkdir /var/cache/nginx/pagespeed
Read more
Anonymous's picture

Just started with Nginx but stuck in redirect loops

hey,

just about to move from lighttpd to nginx. but for some reason i can't manage to get it to work. i used perusio config from github but always end up in redirect loops. i got the feeling that i need to learn a bit more about this config and tried a fresh drupal setup with a very minimal nginx conifg out perusio version. but even then i only manage to get redirect loops between / and install.php

can anyone help me to get a minimal working nginx.config for a fresh drupal setup without any fancy stuff?

my nginx.conf:

user nginx nginx;
worker_processes 1;

Read more
apotek's picture

Latest D7 security update changes to htaccess. How to implement in nginx configuration

The 7.22 security update for D7 includes some interesting and challenging modifications to the standard drupal distributions .htaccess file.

Read more
r2b2's picture

Server keeps going down with 502 Bad Gateway error

Hi,

We recently moved to DigitalOcean and used nginx. My colleague who set it up left the company just right after we launch the site and so we are at a lost on how to solve this problem.

Here are the server logs, if it may help. There are also several config files, which one do I need to display here?

I hope you can help us,thank you in advance.

tail -f /var/log/php5-fpm.log

[22-Apr-2013 08:00:33] NOTICE: [pool www] child 4923 started
[22-Apr-2013 08:23:25] NOTICE: [pool www] child 1569 exited with code 0 after 10287.032182 seconds from start

Read more
Anonymous's picture

nginx config for multiple drupal installations

I have been looking/trying this but couldn't find perfect solutions. I was testing multiple Drupal installations and my configs is like

server {
    server_name localhost;
    listen 80;
    root /var/www/mainsite;
}

I have main site which has a link to forum and I have forum site in /var/www/forum; The main site and forum site has their own settings.php and files. It is just separate project but linked with each other, as the forum has link to main site via home button.

how do I acheive this with Nginx, I tried

server {
server_name localhost;

Read more
Anonymous's picture

conflicting server name ignored

While restarting Nginx I get the warning mentioned below. I don't have other servers running just one domain with ssl, and I have defined server name after every server block. I'm using 99% Perusio's config, 1% mine server name and some values.

Read more
Anonymous's picture

conflicting server name "example.com" on 0.0.0.0:80, ignored

While restarting Nginx I get the warning mentioned below. I don't have other servers running just one domain with ssl, and I have defined server name after every server block. I'm using 99% Perusio's config, 1% mine server name and some values.

Read more
fehin's picture

Has anyone been able to get their Drupal with Nginx to work with image style after 7.20 upgrade?

I have tried several tips and none worked. I also used the recommended fix $conf['image_allow_insecure_derivatives'] = TRUE;, it didn't work. I tried the module version of it http://drupal.org/project/image_allow_insecure_derivatives, still not working.

Read more
bhosmer's picture

File Upload Size Limits

I've migrated an OpenAtrium site from Apache to an NGINX server using spawn-fcgi.

I've set my max_uploads and max_post size in php.ini, and made adjustments to the user permissions as far as upload file sizes.

I've tested this issue using the same site and database with Apache, and don't have any upload issues.

Here is the error I get:

The selected file 8mbfile.txt could not be uploaded. The file is 8 MB which would exceed your disk quota of 9 MB.

As you can see, my file upload size set in my php.ini is 9MB.

Read more
RedRat's picture

Which PHP files of core and modules must be accessible from browser?

First of all, excuse my English. I hope you can understand what I want to ask.

For a long time I have used this NginX config as a template for mine own, but I am very unsatisfied with it's security concerning PHP files. I mean, there are only some PHP files which a really needed for Drupal to work: index.php, update.php and cron.php (install.php used only once and I don't use any features of xmlrpc.php). So I want to rewrite my NginX config to grant access only for enlisted PHP files.

Read more
scottm316's picture

clean URLs on nginx

Hi.
I posted a nginx question with some configs in the drupal.org post-installation forum. Would anybody have a few minutes to review the config I posted and tell me if they see anything blatently wrong? I simply cannot get clean URLs to work. The config I'm adapting is the boost one, and to note may be that the last commit to that repo was over 3 years ago so maybe there's something new?

Read more
stodg's picture

Drupal and nginx upload module

I've been looking at using the upload module with drupal but I have not found any module that uses it, I've found modules that support upload_progress (FileFieldNginx), but when using it the upload is still processed directly by PHP.

Is there a module around that I'm not aware of?

If it does not exist, is that because it makes no sense or because nobody worked on it?

Read more
smoneyan's picture

Using variables in access_log, error_log

Hi,
I am using nginx 1.1.19. I am using the following configuration for my site.

I don't want to repeat the site name in access_log, error_log, php_log like this

access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log debug;
fastcgi_param  PHP_VALUE "error_log=/var/log/php/example.com.error.log";

I am trying this config. But i end up having file names like in my log folder.
$host.error.log.
I know i'm doing something wrong. Could any one of u help me ?

server{
listen 80;

Read more
Garrett Albright's picture

Nginx/FastCGI vs Apache/mod_php: What's faster?

chx shared an interesting article via his Twitter feed today; some speed comparisons of Apache with the mod_php extension (which embeds the PHP interpreter into Apache for faster but less-secure execution) versus Nginx and PHP via FastCGI.

Read more
jpstrikesback's picture

Kalabox Nginx config

Has anyone played with the Kalabox VM from:

http://kalabox.kalamuna.com/

?

I am having no luck getting image styles to function. Images at style paths are returning:

"Error generating image."

Permissions are fine (according to drupal when saving settings at the file system settings)

I've tried a few of the following:

location ~ ^/sites/.*/files/styles/ {
    try_files $uri @cleanurl;
}

location ~ ^/sites/.*/files/styles/ {
    access_log off;
    expires 45d;
    error_page 404 @cleanurl;
}

the full config (without those items) is as follows:

Read more
fehin's picture

Nginx showing default page instead of installed Drupal page

I used Perusio's setup and Nginx and php5-fpm are running without errors. My root files are located at srv/www. I indicated this in the config and enabled the sites with
ln -s /etc/nginx/sites-available/website1.com /etc/nginx/sites-enabled/website1.com.

I don't know what I'm missing.

Read more
tbenice's picture

Private file system image styles *.conf

For those who use the private file system for images (or amazons3 which uses private file system), the following needs to be in your .conf for nginx:

# Catch image styles for private files.
        location ~ ^/system/files/styles/ {
                try_files $uri @rewrite;
        }

The stated config:

# Catch image styles for private files.
        location ~ ^/sites/.*/private/styles/ {
                try_files $uri @rewrite;
        }

does not work.

Read more
flocondetoile's picture

Nginx and syntaxhighlighter_insert module

Hello,

I'm trying to use the syntaxhighlighter_insert on my drupal site.
I use the perusio's configuration for my nginx server.

When i use this module in a wysiwyg editor, he try to open the form at the adress below

http://drupal.local/index.php?q=syntaxhighlighter_insert_wysiwyg/insert/

Of courses i obtain a 404 page as the configuration reject with a 404 error any other attempt to access to PHP files

Any other attempt to access PHP files returns a 404

location ~* ^.+.php$ {
return 404;
}

So, Have you got an idea how to access to this form ?

Read more
dutgriff33's picture

Nginx config can not get the rewrite right on EC2. Message "The requested page "/" could not be found."

I have been working on this for a few days now and I can not get it to work. I am having the same error after every install on my amazon EC2. I have done the exact steps as on my local machine and it will not work for me on my EC2 server. I am getting to the end of the installation right after it asks for the databases info and it goes to a page saying "Page not found. The requested page "/" could not be found." this is being displayed in the Drupal default theme so it is working. If you are reading this before I get it fixed check out dutgriff.com to see what it is displaying.

Read more
likewhoa's picture

NGINX microcaching producing high FBT times.

I have a site setup were I am benchmarking boost with nginx vs nginx with microcaching and it shows that using microcaching produces a First Byte Time of around 0.984s while nginx+boost without microcaching produces 0.257s.

I know that microcaching should be producing better or similar numbers but in my case it's the appositive.

I like to get to the bottom of this odd issue.

P.S I am using perusio's d6 branch

Read more
Subscribe with RSS Syndicate content

Nginx

Group organizers

Group notifications

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