Posted by stoyan
Preparation
I added PHP to bbox512 nginx . For Debian/Ubuntu it needed FastCGI:
# apt-get install libfcgi0
RTFM
Installation
# cd /etc/default/
# wget -O php-fastcgi http://zhware.net/files/nginx/php-fastcgi.txt
# cd /etc/init.d/
# wget -O php-fastcgi http://zhware.net/files/nginx/php-fastcgi.rc.txt
# chmod 755 php-fastcgi
# cd /opt/nginx/conf/sites/
# wget -O static.conf http://zhware.net/files/nginx/sites/static.conf.txt
# /etc/init.d/php-fastcgi start
# kill -HUP `cat /opt/nginx/logs/nginx.pid`
In fact it’s just starting FastCGI PHP instances and making small changes to the sites/static.conf to process files with .php extension:
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /opt/nginx/html$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
}
Posted by stoyan
There is a new version of the nginx web server – nginx-0.5.24 . Too many upgrades recently :(
From the changelog:
Bugfix: a part of response body may be passed uncompressed if gzip was used; bug appeared in 0.5.23.
I have a small ugly shell script for upgrading:
#!/bin/sh
VER=0.5.24
if [ ! -d ~/Work/nginx-${VER} ]; then
cd ~/Work
wget http://sysoev.ru/nginx/nginx-${VER}.tar.gz && \
tar xvzf nginx-${VER}.tar.gz
fi
if [ -d ~/Work/nginx-${VER} ]; then
cd ~/Work/nginx-${VER} && ./configure --prefix=/opt/nginx \
--with-openssl=/usr/lib/ --with-sha1=/usr/lib \
--with-http_realip_module --with-http_ssl_module && make
fi
The interesting part is after the installation –
upgrade the server executable “on the fly” , without restarting:
% cd ~/Work/nginx-0.5.24
% sudo make install
% sudo kill -USR2 `cat /opt/nginx/logs/nginx.pid`
% tail -f /opt/nginx/logs/error.log
2007/06/07 14:27:23 [notice] 4382#0: signal 12 (SIGUSR2) received, changing binary
2007/06/07 14:27:23 [notice] 4382#0: changing binary
2007/06/07 14:27:23 [notice] 4382#0: start new binary process 6500
2007/06/07 14:27:23 [notice] 6500#0: using inherited sockets from "6;7;"
2007/06/07 14:27:23 [notice] 6500#0: using the "epoll" event method
2007/06/07 14:27:23 [notice] 6500#0: nginx/0.5.24
Well done software = happy sysadmin = happy users :)
Posted by stoyan
I put some notes for nginx on my wiki .
The rails system administration is like waves – somebody found a new software and the community just fulfill it. Maybe there must be some name for this effect. Something like digg-effect but maybe Rails wave hahaha.
First there was lighttpd , now nginx comming. Maybe your piece of code will be the next. Are your ready? ;)