Debian server optimization and run lua wsapi as fastcgi

step1) check ulimit -a (see open files)
/etc/security# vim limits.conf
add:
* soft noproc 36000
* hard noproc 36000
* soft nofile 655360
* hard nofile 655360

step2) use nginx and spawn-fcgi for lua
document: http://forum.slicehost.com/comments.php?DiscussionID=4523
http://davelahn.com/lua-nginx-fastcgi-in-debian
http://jim.studt.net/depository/index.php/setting-up-nginx-and-lua-fastcgi-on-debian-squeeze

command like:
spawn-fcgi -F 4 -u www-data -g www-data -a 127.0.0.1 -p 9099 -P /var/run/nginx-lua-fcgi.pid — /usr/local/bin/wsapi.fcgi

lua wsapi should install by latest luarocks.

step3) nginx.conf
add following (9099 is assigned in step2):
location ~ \.lua$ {
fastcgi_pass 127.0.0.1:9099;
fastcgi_index index.lua;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
include fastcgi_params;
}

发表评论