'405 Not Allowed' error serving Facebook apps with nginx

I’ve spent the last couple of evenings playing around with some Hello World-type stuff for Facebook app development in preparation for an up-coming Facebook/Rails gig. After creating a new app on Facebook, you are presented with the code for a basic starter-page for the app: ...

May 20, 2011 · 2 min · Dave Perrett

Compiling Nginx with flv streaming support on Ubuntu

First, we need to get the latest version of nginx : > wget http://nginx.org/download/nginx-0.8.34.tar.gz > tar xvzf nginx-0.8.34.tar.gz > cd nginx-0.8.34 Next, configure it to support ssl, gzip, flv streaming and real-ip. I generally compile it to /opt/nginx-YYMMDD (change the –prefix setting if you want to put it somewhere else) : ...

March 16, 2010 · 3 min · Dave Perrett

nginx error - 413 Request Entity Too Large

If you’re getting 413 Request Entity Too Large errors trying to upload with {{ “nginx.net/” | ext_link: “Nginx”}}, you need to increase the size limit in nginx.conf . Add ‘client_max_body_size xxM’ inside the server section, where xx is the size (in megabytes) that you want to allow. http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { client_max_body_size 20M; listen 80; server_name localhost; # Main location location / { proxy_pass http://127....

November 18, 2009 · 1 min · Dave Perrett

Customize the Nginx server header

Unfortunately the only way to change the server header in nginx is to actually recompile it from source. Luckily this is quite easy. First, download the latest version of nginx (0.7.61 at the time of writing) : > wget http://sysoev.ru/nginx/nginx-0.7.61.tar.gz > tar xvzf nginx-0.7.61.tar.gz > cd nginx-0.7.61 ...

August 10, 2009 · 2 min · Dave Perrett

Passing IPs to apache with nginx proxy

When you use nginx to proxy to apache , apache picks up the IP address of your nginx proxy as the client. A consequence of this is that apache log files, and any application running on the apache backend, will all receive the same IP address (for example 127.0.0.1 if apache and nginx are running the same server). Luckily, nginx provides a HTTP X-Forwarded-For header containing the clients real IP address, although apache doesn’t pick it up by default. To allow apache to recognize the original client IP, we need to install the mod_rpaf module. On ubuntu, this is as simple as installing a package : ...

August 10, 2009 · 2 min · Dave Perrett

Nginx adds strange characters using rails/memcached_pass

After upgrading a few gems recently, I found that the content returned from the nginx memcached_pass directive always had a few strange characters prepended. After some investigation it seems that this is caused by rails ‘marshalling’ the data. If you’re using a memcached set command such as Cache.set(key, content, time_to_live) You need to add an extra argument to force rails to cache the raw data instead of marshalling it : ...

December 23, 2008 · 1 min · Dave Perrett