Nginx

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.

bugsonly's picture

D8 + split-nginx frontend + backend-proxy config loses D8 theming; otherwise functions OK

I run nginx 1.9.9 + php7 + php-fpm

With a single, standlone nginx config, I installed Drupal 8.0.1. Everything works & displays correctly.

Next, I need to split the nginx config into front-/back-ends.

I created two configs for the front- & back-ends.

In the split-config, Drupal functions correctly, but displays no themeing; just 'generic'.

css links in ViewSource are accessible.

I suspect I've missed something in header-passing between the front & back.

Here are the current configs I'm working with,

frontend:

server {
server_name dev.example.com;

Read more
olomouc's picture

mixture of drupal and non-drupal sites with Perusio config

I have a couple of no drupal sites i need to put on a server containing mostly drupal sites one of which should be served with index.html. If I browse to index.html then the site is fine but I cant get the root url to show index.html.

If I put this as a nested location in drupal.conf then it works but it then breaks all the drupal sites. I can't put it in the site config because it compains of duplicate location directives.

location / {
try_files $uri /index.html;
}

Read more
Nikhil Mohan's picture

Drupal path problem with nginx/1.9.5

I am trying to install drupal on nginx 1.9.5
here is my default.conf http://pastebin.com/4hTBnSJf

When i set up my css/js paths are missing see att.

its like

@import url("http://192.168.52.211/modules/system/system.base.css?0");
@import url("http://192.168.52.211/modules/system/system.admin.css?0");
@import url("http://192.168.52.211/modules/system/system.menus.css?0");
@import url("http://192.168.52.211/modules/system/system.messages.css?0");
@import url("http://192.168.52.211/modules/system/system.theme.css?0");

Read more
hkvega01's picture

Nginx as frontend of apache images style not generate when clean-url is on

i'm trying to make a nginx as a proxy of apache, when the clean-url is on, i upload a image to a field, the thumbnails is not generated. I had read all of the thread around the google and tried every solutions but not work, here is my nginx vhost file

server {

 listen 80;
 server_name www.example.com example.com;
 access_log /var/log/virtualmin/example.com_nginx_access_log;
 error_log  /var/log/virtualmin/example.com_nginx_error_log;

 location / {

    index index.php;
proxy_pass http://192.168.1.104:8086;
    include /etc/nginx/proxy.conf;
Read more
olomouc's picture

Image styles when imported from apache not creating

I have a bunch of image files that have come from an apache staging server which have been converted, e.g a space has been converted to %20, so the imported images are my%20image.jpg. These are not viewable and the subsequent image styles are not being created. If I upload images with spaces directly on to nginx then no problem. I am using Perusio's config which seems to be setup to resolve escape characters, however it doesnt like files with % signs in them. Any ideas how to resolve this?

luxpir's picture

Simple SPDY config not working

I've posted this issue in the queue at the Perusio config page on github, but wondered if anyone else has an idea in more general terms of how to get an up to date system to do an NPN handshake?

Github issue


  • Ubuntu 12.04 LTS
  • Nginx 1.7.12 (upgraded today from Ubuntu mainline/dev PPA)
  • OpenSSL 1.0.1 (build from 19/03/15 - upgraded today)
Read more
olomouc's picture

Issue with Image styles where spaces in image title

I have noticed that images with spaces - rewritten as %2520 - are not being saved to the image style folder. If I resave the image with a sensible title then the image gets saved in the image style folder. I am using Perusio's config. Does anyone know how I could fix this in drupal.conf (with a rewrite?)?

haunted's picture

Tutorial to tune php-fpm

Hello people, i run my drupal 7 site on a VPS with 1GB of ram with a LAMP stack. I would like to switch to nginx and php-fpm because people keep saying that php-fpm saves a lot of memory compared to apache mod_php.

Unfortunately, the last time I tried, i did not have much success. I had the cpu overloaded, or soimetimes "page not found" for some pages pages, or max-children limit reached in logs.

Read more
olomouc's picture

Is this an nginx issue with node add form?

I am not sure this is a great way to do this but I have been trying to get a node/add/form available to anonymous users. Whichever content type I set permissions for anonymous to add content I get access denied (403). I thought this might be something in Perusio's config that disallows this - ddos reasons - but if I select 'Bypass content access control' for anonymous as a test then I can see the node/add/form as anonymous user. Do you think this could be an nginx issue that 'Bypass content access control' is able to override?

olomouc's picture

Stuck with Perusio config

I have installed nginx and php5-fpm and using perusio's D7, tcp configs but the best I can get is the default index.html page in /usr/share/nginx/html. Even with the 000-default virtual host disabled i still get that html page. If I comment out example to the best of my understanding i get a loopback issue. So i disable 'return' line and then I get back to index.html.

I would be very grateful for some pointers. Here is my virtual hosts file. Ive got dns pointing to nginx.*.org.uk


server {
listen 80; # IPv4
server_name nginx.*.org.uk;

Read more
heyyo's picture

Symlink in document root produces error 404

Before starting, i should say I don't have this issue with Apache, only with Nginx. I'm using perusio config for Drupal 7.

I'm using the module subfolders domains (https://www.drupal.org/project/subfolders_domain) to create domains as subfolders(uri) of my main domain.
PS: This module is using the module Domain Access

This module creates symbolic links in drupal document root for each subfolder.

Example: in my Drupal document root I have several symlinks:

france -> /var/www/drupal
uk -> /var/www/drupal
index,php
modules
themes
sites...

Read more
Kristina Katalinic's picture

prevent search engines from indexing CDN Subdomains

Hi all,
I am new to nginx so hopefully someone here can help me.
Since my site will have a lot of images submitted by registered users I use CDN module to serve static files from Cloudfront and that is working well.
But there is one serious caveat: my site can be accessed from CDN subdomains thus creating a duplicate content issue which is a serious problem for SEO.
I've searched high and wide before posting here but with no success.
Is there a way to prevent search engines from indexing my CDN subdomains?
My CDN setup looks like this:
http://js.mysiteurl|.js .otf .ttf .woff .eot

Read more
spessex's picture

Solution for x 2 SSL's sitting on same architecture?

Hi

I was hoping someone might be able to help with an issue that I have.

Basically I want two different SSL's (as they belong to two different and independent companies) to sit on my AWS architecture but my architect is trying to tell me this is not possible, which I personally can't quite believe.

The current system has been working perfectly for around 6 months using the x 1 SSL cert, but now I want to use a 2nd SSL cert this is where the problem has raised its head.

Read more
Jason Ruyle's picture

Nginx SSL with ajax issue

We have a configuration issue right now and I'm guessing others have experienced it.

We run a site that uses paths like:

/wishlist/ajax/js
/rental/ajax/js

When running on our staging area (on same server) they return the proper results (the ajax update is called and things work correctly).

When we run it on our https version of the site, they return a 404 error.

POST https://oursite.com/wishlist/ajax/js 404 (Not Found)

On the https version of the site, if I change the url to:

/?q=wishlist/ajax/js

Things work correctly again.
What am I missing here?

Read more
superfedya's picture

Perusio D6 config and ngx_cache_purge and CloudFlare question

Hi,

I installed Nginx with ngx_cache_purge module. I want to use it with this module: https://www.drupal.org/project/purge
http://labs.frickle.com/nginx_ngx_cache_purge/

Somebody know where I need put:

proxy_cache_path   /tmp/cache   keys_zone=tmpcache:10m;

location / {
proxy_pass      http://127.0.0.1:8000;
proxy_cache     tmpcache;
  proxy_cache_key     $uri$is_args$args;
proxy_cache_purge   PURGE from 127.0.0.1;
}

I found proxy_cache_path in fastcgi_microcache_zone.conf - /var/cache/nginx/microcache.

And about CloudFlare.

Read more
x.algorithm's picture

Issue with image thumbnails appearing (image styles)

I am unable to get thumbnails and other images that use image styles to work.

http://ursusfightclub.org/people/profile/makoto

'Taking the field in Belmonte' should be the alt tag for the image.

Users are also unable to reset passwords. It returns "You are not authorized to access this page."

I believe they are related to rewrite and nginx

I've checked and utilized https://groups.drupal.org/node/273378
I've attempted to implement Perusio's config http://github.com/perusio/drupal-with-nginx

Read more
johntang's picture

Please help: Nginx config for Drupal + APC + Php + FPM

Hello there,

I use OpenVZ with 4 CPUs and 4GB RAM on Redis 6 (Final). I running Drupal 7 using perusio config and seem the site is load slowly.

My server is using Nginx PHP-FPM, APC, Redis.

These are my config for PHP-FPM:


[www]
listen = /var/run/php-fpm.sock

listen.allowed_clients = 127.0.0.1

user = apache
group = apache

pm = dynamic
pm.max_children = 20
pm.start_servers = 7
pm.min_spare_servers = 5
pm.max_spare_servers = 10
pm.max_requests = 200

slowlog = /var/log/php-fpm/www-slow.log

php_flag[display_errors] = off

Read more
felixodie's picture

Using Expire on Nginx config making all new images disappear

Hello there,

I've been trying to use browser cache more efficient so I thought using expire in Nginx would be a good idea.

However when I add this code to my Nginx config, all images I've uploaded after the config disappears.

To be more clear;

-Let's say I've uploaded file flower.jpg to my webpage. After upload it looks just fine.
-Then I go to nginx configuration and add following lines to it.
-After that I upload car.jpg file and it's not showing up anywhere. Not in my main page which I use a 100x200px image style, not in node where I use the original image.

Read more
rajibmp's picture

SetEnv how to?

How Do I set Apache's equivalent of SetEnv in Nginx-Drupal.

In the old Apache config, there are some variables defined in the Vhost config eg:

SetEnv db_type mysql
SetEnv db_name mydb
SetEnv db_user root
SetEnv db_pass root
SetEnv db_host localhost
SetEnv db_port 3306

If I go to phpinfo then I can see these variables available in PHP Variables via _SERVER array like _SERVER['db_host'] = localhost and so on.

Now according to surfing the Nginx docs they say to use fastcgi_param. So, my take on its equivalent is:


fastcgi_param db_type "mysql";

Read more
eule's picture

perusio blacklist.conf error invalid number

Hello,
here is my blacklist.conf file who i try to deny some bots, but i get the error "nginx: [emerg] invalid number of the map parameters in /etc/nginx/blacklist.conf:12"

if i do this in a server location it works fine but not with the blacklist.conf from perusio ...whats wrong??

-- mode: nginx; mode: flyspell-prog; ispell-local-dictionary: "american" --

This file implements a blacklist for certain user agents and

referrers. It's a first line of defense. It must be included

inside a http block.

Add here all user agents that are to be blocked.

Read more
Subscribe with RSS Syndicate content