Nginx Issues

The other day, I had everything running nice and smoothly on Nginx, and it was remarkably faster.

I was about to port another site over which was heavy on uploads. So, instead of using Flash and having to use a FlashSessionCookieMiddleware in Rails, I decided to use the nginx-upload-progress-module¬†and use data straight back from the server to make a progress bar. This is where things started to get interesting…

I had originally installed Nginx via yum, so I had no ideas what modules they included in that particular distribution. After searching around for a while, I decided it would be best to just compile Nginx from source. I figured that this would give me the most up-to-date version, and I could add any additional modules I wanted.

I kept a copy of how yum configured Nginx when it installed to work from, and pretty much copied it verbatim and then added/removed modules as I went through.

--user=nginx --group=nginx --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --pid-path=/var/run/ --lock-path=/var/lock/subsys/nginx --without-http_fastcgi_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables' --add-module=/opt/nginx-upload-module --add-module=/opt/nginx-upload-progress --add-module=/opt/nginx-upstream-fair

This is where I ran into all kinds of problems. It would configure, but would exit out with errors when I tried to make. After quite a long time searching, I decided to just give it a shot leaving out

--with-cc-opt parameters


It worked! Everything is back up and running smoothly. Hopefully this option was worth it.

So far, this is my first knock against Nginx. Unlike Apache, you can’t dynamically include modules.

From WordPress to Radiant CMS

So, yesterday I spent a little time migrating a site from WordPress to Radiant CMS, and so far I couldn’t be happier.

I didn’t do this because I was unhappy with WordPress, but because I wanted to trim my server down by running nginx instead of Apache. This WordPress install was the last thing that I felt like was easier running on Apache, and for some reason I had reservations about running PHP/FastCGI on nginx just to run a simple WordPress site.

Right now, the site isn’t a blog, rather just a site that I did for a customer and wanted them to be able to update/add content easily. So, really, any CMS would do.

I chose Radiant CMS for no other reason than it’s in my favorite language, Ruby. After a quick read through the docs, I gave it a go.

Installation was typically easy for any of these types of things; just create a database, run a couple scripts to migrate/seed it, and off you go.

What I surprisingly like so far, is being able to add/edit snippets, layouts, css, and js directly in the CMS. Obviously, it’s not the most elegant text editing environment, but, I was copy and pasting some old css, and bits and pieces from the WordPress files, and it went really seamlessly.

I like the idea of being able to change the layout of the sidebar wherever I’m at, and not have to do a cap deploy, or fire up FileZilla to upload the file.

Finally, I felt like Radiant CMS was just a better fit for this particular site. It isn’t a blog, so a general purpose CMS is much more appropriate in my mind.

It is up and running today with no problems so far, but I still have a little work to do on my server.

  1. Figure out exactly how to monitor the site with Monit (kinda odd using rvm)
  2. Move all of my other sites off of Apache/Passenger and on to nginx/Unicorn (or Thin, or Passenger…)
  3. Dump Apache, and hopefully watch my free memory jump!

Stay tuned as I hope to post more about this in the future.


Just got Monit keeping an eye on this. Pretty easy actually.

  1. Create a simple Rackup file (see RailsGuides)
  2. Point the actual Ruby binary, probably somewhere in

    to the actual server binary (in this case, Thin), and point that at your new

Now, once nginx is fired up, I’ll have it serve all static files, and get rid of

use Rails::Rack::Static

in the

Till then…