因为博主的博客,使用的是nginx,所以打算平滑升级并且配置成 openresty 所以,这里我配置了一下,然后记录下来给大家,大家可以通过 www.widuu.com/lua 来测试一下。
#centos
yum install libtermcap-devel ncurses-devel libevent-devel readline-devel pcre-devel openssl-devel gcc -y
#ubnutu
apt-get install libreadline-dev libncurses5-dev libpcre3-dev
libssl-dev perl make build-essential
2.安装软件和扩展
(说明)这里我是安装了 nginx , 但是我的版本是 1.6.0 不支持所以只能平滑升级了,如果你是新安装,只需要最后一步的 make upgrade 替换成 make install 就可以了。
在 http://luajit.org/download.html 这里现在luajit ,我选择的是稳定版本的 2.0 你可以选择 2.1 这个这里无所谓。
在 http://www.lua.org/ftp/ 这里下载 lua5.1* 版本,因为目前只支持到 5.1 的版本。
在 https://github.com/simpl/ngxdevelkit/tags 下载最新的 nginx_devel_kit。
在 https://github.com/openresty/lua-nginx-module/tags 这里下载 lua-nginx-module 的最新版本。
在 https://github.com/openresty/headers-more-nginx-module/tags 下载 headers-more-nginx-module 。
在 https://github.com/openresty/echo-nginx-module/tags 下载 echo-nginx-module。
在 https://github.com/openresty/xss-nginx-module/tags 下载 xss-nginx-module 。
在 https://github.com/openresty/array-var-nginx-module/tags 下载 array-var-nginx-module。
在 https://github.com/openresty/rds-json-nginx-module/tags 下载 rds-json-nginx-module。
在 https://github.com/openresty/redis2-nginx-module/tags 下载 redis2-nginx-module
在 https://github.com/openresty/memc-nginx-module 下载 memc-nginx-module。
在 https://github.com/openresty/rds-csv-nginx-module/tags 下载 rds-csv-nginx-module。
在 https://github.com/calio/form-input-nginx-module/tags 下载 form-input-nginx-module。
在 https://github.com/calio/iconv-nginx-module/tags 下载 iconv-nginx-module 。(可选)
在 https://github.com/FRiCKLE/ngx_coolkit/tags 下载 ngx_coolkit。
在 https://github.com/openresty/set-misc-nginx-module/tags 下载 set-misc-nginx-module。
在 https://github.com/openresty/encrypted-session-nginx-module/tags 下载 encrypted-session-nginx-module 。
在 https://github.com/openresty/srcache-nginx-module/tags 下载 srcache-nginx-module 。
在 https://github.com/openresty/lua-upstream-nginx-module/tags 下载 lua-upstream-nginx-module。
下载 http://nginx.org/en/download.html,因为有的模块是需要在 1.6 版本以上的,所以安装版本必须大于 1.6。
3.解压安装
将上边所有的包解压了,最好放到一个文件夹中,我的是放在 /data/soft 下,然后开始安装。
1.安装lua
cd lua*
make linux test
# 我的个人喜好
cp src/lua /usr/local/lua
2. 安装LuaJIT
cd ../LuaJIT*
make
# 这里你可以使用 make install PREFIX=/path 来指定你的安装目录,默认的lib库,都安装到/usr/local/lib 下了,一般默认
make install
3. 我的是已经安装好了 nginx 所以是平滑升级,你可以直接安装
# 如果是2.0 指定2.0的luajit的安装目录
export LUAJIT_LIB=/path/to/luajit/lib
export LUAJIT_INC=/path/to/luajit/include/luajit-2.0
# 如果是2.1 指定 2.1的安装目录
export LUAJIT_LIB=/path/to/luajit/lib
export LUAJIT_INC=/path/to/luajit/include/luajit-2.1
如果你是升级,你可以这样操作,我的 nginx 的存放目录是 /usr/local/nginx ,然后
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
# 进入 nginx 安装包
cd nginx*
# configure参数,注意,我add-module 将后边的版本号都省略了,你对应你的版本号和路径对应好
./configure --prefix=/usr/local/nginx
--with-ld-opt="-Wl,-rpath,/usr/local/lib"
--add-module=../ngx_devel_kit
--add-module=../lua-nginx-module
--add-module=../iconv-nginx-module
--add-module=../echo-nginx-module
--add-module=../xss-nginx-module
--add-module=../ngx_coolkit
--add-module=../set-misc-nginx-module
--add-module=../form-input-nginx-module
--add-module=../encrypted-session-nginx-module
--add-module=../srcache-nginx-module
--add-module=../lua-upstream-nginx-module
--add-module=../headers-more-nginx-module
--add-module=../array-var-nginx-module
--add-module=../memc-nginx-module
--add-module=../redis-nginx-module
--add-module=../rds-json-nginx-module
--add-module=../rds-csv-nginx-module
# 然后这里再加上你的 nginx configure 参数就可以了
#编译
make
这里注意了,如果你是升级不要进行 make install,升级是这样操作的
cp objs/nginx /usr/local/nginx/sbin/nginx
make upgrade
如果不是升级,可以直接安装
make install
这里你就安装好了
/usr/local/nginx/sbin/nginx -V #可以查看参数
4. 测试一下
vim yourwebsite.conf
#添加如下
location /lua {
default_type text/html;
content_by_lua '
ngx.say("hello word lua");
';
}
凡尔赛法环免广告版 最新版v1.69.1
下载天煞异种 安卓版v1.0.21
下载十三月 (Undecember)最新官方中文版v3.26.0200
下载我不是废柴无限99999钻999999金币游戏 不减反增版v1.2.16
下载我的女友是声优免广告 安卓版v1
我的女友是声优免广告是一款非常好玩的模拟经营类手游,玩家在游
石器帝国去广告版 v8
石器帝国免广告版是游戏的破解版本,在该版本中为玩家去除了广告
校园恋爱模拟器真人版去广告版 v0.0.7
校园恋爱模拟器真人版免广告版是游戏的破解版本,在该版本中为玩
教练我要开球馆内置菜单修改器 安卓版v1.5.4
教练我要开球馆内购版是一款模拟经营类游戏,玩家们将在游戏中创
我的游轮无限砖石 安卓版v1.7.0
我的游轮无限金币钻石版是一款模拟经营类游戏,你将成为一艘游轮