1、下载openresty-1.19.3.1 源码包
wget https://openresty.org/download/openresty-1.19.3.1.tar.gz
2、下载openssl prce zlib
wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
wget https://jaist.dl.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz
wget http://download.zhufunin.com/pcre-8.42.tar.gz 或者
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.42.tar.gz
3、解压、建议找一个目录,放在一起,我的是 /home/openresty
mkdir -p /usr/local/software
解压上面的4个文件
tar zxvf openresty-1.19.3.1.tar.gz
tar zxvf openssl-1.0.2k.tar.gz
tar zxvf zlib-1.2.11.tar.gz
tar zxvf pcre-8.42.tar.gz
4、安装 openresty
yum install -y gcc gcc-c++ perl-devel perl-ExtUtils-Embed
模块--with-http_stub_status_module 在nginx_status的时候会用到
cd //usr/local/software/openresty-1.19.3
./configure --with-select_module --with-poll_module --with-file-aio --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-http_secure_link_module --with-http_sub_module --with-http_stub_status_module --with-http_perl_module --with-openssl=/usr/local/software/openssl-1.0.2k --with-pcre=/usr/local/software/pcre-8.42 --with-zlib=/usr/local/software/zlib-1.2.11
gmake && gmake install
5启动 openresty
cd /usr/local/openresty/nginx
./sbin/nginx
6、查看是否启动
netstat -nltp | grep "nginx"
7、安装成功之后,可以直接拷贝到另外一台服务器上,直接启动,拷贝openresty
打包
tar zcvf openresty.tar.gz openresty
cd /usr/local/lib64
tar zcvf perl5.tar.gz perl5
然后拷贝到新服务器目录/usr/local
cd /usr/local
tar zxvf openresty.tar.gz
cd /usr/local/lib64
tar zxvf perl5.tar.gz
需要拷贝perl5目录,否则启动会失败,缺少perl模块
报错信息如下
Can't locate nginx.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.
nginx: [alert] perl_parse() failed: 2