So today I replaced apache2 with nginx on my slice at slicehost and here is how I've done that.
First of all download nginx form here and unpack it somwere. The installation is a standard source installation. I've done it like this on my Debian Etch slice.
# ./configure --with-http_ssl_module
--sbin-path=/usr/local/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid
# make
# sudo make install
After that I've customized nginx.conf for my needs following this example and I also used this startup script that I also customized. Now all that I needed to do was to copy the nginx startup script into /etc/init.d, make it executable, stop apache and start nginx.
# sudo cp /somewhere/nginx /etc/init.d/nginx
# sudo chmod +x /etc/init.d/nginx
# sudo update-rc.d nginx defaults
# sudo update-rc.d -f apache2 remove
# sudo invoke-rc.d apache2 stop<br />
# sudo invoke-rc.d nginx start
And that's it. Hope it helps someone :)
I will still keep apache installed. I might have some use of it somewhere or sometime :)
P.S. The nginx.conf example I am refering to is customized for a rails application using a cluster of two mongrel instances. For other examples please see here.
Posted in Linux, 2 Comments
Here are some useful tips & tricks I frequently use:
VIM search/replace commands
replace the first 'old' in a line with 'new' :s/old/new
replace all 'old's on a line with 'new' :s/old/new/g
replace all occurrences in the file :%s/old/new/g
confirmation each time :%s/old/new/gc
flv to mpeg4
ffmpeg -i v.flv -s 320×240 -r 15.00 -b 300 -f avi -vcodec mpeg4 v.avi
Extract audio
mplayer -dumpstream v.avi
mplayer -ao pcm stream.dump
subversion add multiple files
svn st | grep "^?" | awk '{ print $2 }' | while read f; do svn add $f;done
subversion remove multiple files (non existent)
svn st | grep "^\!" | awk '{ print $2 }' | while read f; do svn delete $f; done

Full name: Ivica Munitic
Age: 28
Profession: Developer
Email: ivica@munitic.com.hr