nabeel shahzad

Archive for the ‘nginx’ Category

Node.js and nginx

with 2 comments

This took me some time to figure out, and I didn’t see any detailed posts or bug reports on how to fix this. Nginx doesn’t support HTTP 1.1 on proxy pass, meaning, when you place Node.JS behind a proxy (for load balancing purposes, or you just have multiple endpoints on port 80), websockets will not work properly, since HTTP 1.1 is a core requirement. You’ll know, when you get errors similar to this:

I’m running nginx 0.6.8, with nginx 1.0.11. To fix this, you need to upgrade to a later version of nginx (a development version), which supports HTTP 1.1 (albeit, experimentally), and then enable the proxy_http_version 1.1 parameter in your vhost configuration.

I’m doing this on Ubuntu.

First, let’s compile nginx:

Next, we setup our vhost:

And now no more errors, and nodejs is working properly. Do note that this is a “bleeding edge” version of nginx, and could come with its own share of issues – so keep an eye out and test thoroughly!

Edit: If you’re still running into some problems, you can enable only xhr-polling/jsonp-polling in your Node.JS/socket.io configuration:

Written by Nabeel

January 21st, 2012 at 7:48 pm

Posted in General,nginx

Installing Redmine on Ubuntu 11.04 w/nginx and mongrel

without comments

This one took me a few hours, but I’ve got my handy-dandy notes. I’m going to assume you’re got nginx installed, whether there are vhosts or not…

I’m also installing to /var/www/redmine

Next, we are going to patch Redmine, to work with Mongrel

Next, setup the right versions of Rails, etc

Now setup MySQL:

And next, we configure and run the installer for Redmine. We are going to edit the database.yml, set it to match your above settings

Next, we start the server

Next, create the nginx vhost, I created it as /etc/nginx/sites-enabled/redmine

Written by Nabeel

October 3rd, 2011 at 6:11 pm

Posted in General,nginx

Tagged with ,

A better way for nginx PHP config

with one comment

Doing some reconfiguration on my webserver (nginx) to make it easier to administer. My first goal was to get rid of this nastiness:

It’s too verbose to copy/paste into each virtual host file. Instead, you can just combine the file into the /etc/nginx/conf/fastcgi_params file. I renamed it to php_params, and this is what it’s got:

Now I don’t have to change it everywhere. So, instead, now I do:

Bam! 6 lines down to one, and much easier to administer. I like, I like.

Written by Nabeel

October 6th, 2009 at 5:23 pm

Posted in General,nginx