安装openresty
openresty 编译安装
-
openresty一般是编译安装的, 需要较新的gcc gcc-c++等
- 通过yum安装环境命令:
yum install -y unzip make gcc gcc-c++ readline-devel pcre-devel openssl-devel perl gd-devel
- 编译命令:
./configure --with-luajit --with-http_image_filter_module --prefix=/usr/local/openresty
- 安装命令:
``` make chmod +x build/install make install ```
- 把lua.zip解压到/usr/local/share
``` mv lua.zip /usr/local/share cd /usr/local/share unzip lua.zip ```
- 把http_headers.lua、http.lua和jit-uuid.lua放置在/usr/local/openresty/lualib/resty中
``` mv http_headers.lua /usr/local/openresty/lualib/resty mv http.lua /usr/local/openresty/lualib/resty mv jit-uuid.lua /usr/local/openresty/lualib/resty ```
- 根据设计方案修改配置文件 配置文件一般包括 nginx.conf、_location.conf、stream.conf、ide_location.conf和ide_location.conf。(如果采用粘贴复制的方式,特别要注意location.conf和ide_location.conf中有没有直接写IP地址),注意microserver.lua和microserver_bycode.lua都需要修改IP地址
cp nginx.conf /usr/local/openresty/nginx/conf/ cp -r scripts /usr/local/openresty/nginx/
- 启动openresty
``` #测试配置是否正确 /usr/local/openresty/nginx/sbin/nginx -t #启动 /usr/local/openresty/nginx/sbin/nginx #重载配置 /usr/local/openresty/nginx/sbin/nginx -s reload ```
- 通过yum安装环境命令:
openresty rpm
方式安装
- openresty rpm方式安装
1. 准备好rpm包
`
openresty-1.13.6.2-1.el7.centos.x86_64.rpm
openresty-openssl-1.1.0k-1.el7.x86_64.rpm
openresty-pcre-8.42-1.el7.centos.x86_64.rpm
openresty-zlib-1.2.11-3.el7.centos.x86_64.rpm`
3. 运行命令 `rpm -ivh --force openresty-*.rpm`
4. 接下来如同编译方式的4-7步骤,在此不再详述了