Archive for August, 2013

Migrate from RPM nginx to source compiled nginx

22 August 2013 13:10

If you’ve installed nginx via rpm/yum you’ll be a bit stuck if you then decide you want to add some modules. In order to add modules, or, use something else you need to compile from source.

Below are the steps I took to get this going. This is on CentOS 6.4.

You’ll need to map things to where they were if you want to keep the exact same locations.

for i in nginx.conf client_body_temp proxy_temp fastcgi_temp uwsgi_temp scgi_temp; do echo "$i:"; locate -b $i; done

You’ll need some pre-requisites.

sudo yum -y install pcre pcre-devel libxml2 libxml2-devel curl curl-devel httpd-devel unzip openssl openssl-devel;
tar xfz nginx-1.4.2.tar.gz;
tar xfz;
unzip release-;
mv psol ngx_pagespeed-release-;

Once you’re all unpacked you can get building.

cd nginx-1.4.2;
./configure \
--prefix=/usr \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/ \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/acces.log \
--http-client-body-temp-path=/var/cache/nginx/client_body_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--with-http_gzip_static_module \
--with-http_addition_module \
--with-http_stub_status_module \
sudo make install;

Now you’ve installed it, replacing the binary in place without dropping traffic.

sudo kill -s USR2 `cat /var/run/`;

Now, I did try compiling this all with mod security 2.7.5 but get segfaults all over. Needs more investigation to figure out why!

Filed: General // No Comments

Move objects Rackspace Cloud Files

20 August 2013 10:51

I had a need to move a bunch of files to a new container in Rackspace’s Cloud Files. Using the handy API Python Bindings (pyrax) this is pretty easy.

import os
import sys
import pyrax
import pyrax.exceptions as exc
import pyrax.utils as utils
creds_file = os.path.expanduser(".rackspace_cloud_credentials")
pyrax.set_setting("identity_type", "rackspace")
pyrax.set_setting("region", "LON")
cf = pyrax.cloudfiles
oldcont = cf.get_container("old_container")
newcont = cf.get_container("new_container")
objects = oldcont.get_objects()
counter = 0
for obj in objects:
 cf.move_object(oldcont,, newcont)
 counter += 1
 print "[%d] %s moved from %s to %s" % (counter,,,

The credentials file, if you’re wondering, looks like this:

username = USERNAME
api_key = KEY

The follow up is to port this to ruby/fog/rumm once I figure out ruby and get time 🙂

Filed: General // No Comments

Twitter   •   About   •   Contact
©2017 Ian Winter. All Rights Reserved.   •   Powered by WordPress   •   Hosted at Memset