一.安装lua
curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz
tar zxf lua-5.3.5.tar.gz
cd lua-5.3.5
make linux test
如果报错:执行
yum install libtermcap-devel ncurses-devel libevent-devel readline-devel
再执行
[root@localhost ~]# lua
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
如上图显示,成功!
二.安装OpenResty
yum install yum-utils
yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
yum install openresty
默认安装目录:
/usr/local/openresty
三.OpenResty测试
在/usr/local/openresty/nginx/conf 目录下编辑 nginx.conf文件。
刷新OpenResty :
./nginx -s reload
会出现下面问题:
nginx: [error] open() "/usr/local/openresty/nginx/logs/nginx.pid" failed (2: No such file or directory)
执行下面命令:(一定要在nginx目录下执行)
/usr/local/openresty/nginx/sbin/nginx -c /usr/local/openresty/nginx/conf/nginx.conf
没有输出任何信息就是成功了,查看log文件夹下面是否有nginx.pid文件,如果有,肯定成功了。重新刷新OpenResty ,
浏览器访问: