文章归档友情连接照片地图

OpenResty+Lapis

分类:Lua编程  作者:rming  时间:2015-08-09

环境

~# cat /etc/issue
Ubuntu 14.04.1 LTS \n \l

安装OpenResty

~# apt-get install libreadline-dev libpcre3-dev libssl-dev perl
~# mkdir src
~# cd src/
~/src# wget http://openresty.org/download/ngx_openresty-1.7.10.2.tar.gz
~/src# tar axvf ngx_openresty-1.7.10.2.tar.gz
~/src# cd ngx_openresty-1.7.10.2/
#by default --prefix=/usr/local/openresty
/src/ngx_openresty-1.7.10.2# ./configure --with-luajit \
--without-http_redis2_module \
--with-http_iconv_module
#配置nginx

为luajit安装luarocks

~/src# wget wget http://luarocks.org/releases/luarocks-2.2.2.tar.gz
~/src# tar zxvf luarocks-2.2.2.tar.gz
~/src# cd luarocks-2.2.2/
~/src# ln -s /usr/local/openresty/luajit/bin/luajit-2.1.0-alpha /usr/local/openresty/luajit/bin/luajit
~/src# find / -name lua.h
~/src/luarocks-2.2.2# ./configure --with-lua="/usr/local/openresty/luajit" --lua-suffix="jit" --with-lua-include="/usr/local/openresty/luajit/include/luajit-2.1"
...
Installation prefix: /usr/local
LuaRocks configuration directory: /usr/local/etc/luarocks
Using Lua from: /usr/local/openresty/luajit
...
~/src/luarocks-2.2.2# make build && make install

Lapis 安装

~# luarocks install lapis

nginx 启动脚本

#! /bin/sh
# chkconfig: 2345 55 25
# Description: Startup script for nginx webserver on Debian. Place in /etc/init.d and
# run 'update-rc.d -f nginx defaults', or use the appropriate command on your
# distro. For CentOS/Redhat run: 'chkconfig --add nginx'
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="nginx"
NAME=nginx
DAEMON=/usr/local/openresty/nginx/sbin/$NAME
CONFIGFILE=/usr/local/openresty/nginx/conf/$NAME.conf
PIDFILE=/usr/local/openresty/nginx/logs/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
set -e
[ -x "$DAEMON" ] || exit 0
do_start() {
$DAEMON -c $CONFIGFILE || echo -n "nginx already running"
}
do_stop() {
kill -INT `cat $PIDFILE` || echo -n "nginx not running"
}
do_reload() {
kill -HUP `cat $PIDFILE` || echo -n "nginx can't reload"
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
do_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
do_stop
echo "."
;;
reload|graceful)
echo -n "Reloading $DESC configuration..."
do_reload
echo "."
;;
restart)
echo -n "Restarting $DESC: $NAME"
do_stop
do_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2
exit 3
;;
esac
exit 0

参考

资料



提交评论