centos 7 源码安装openresty

Posted faberbeta

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos 7 源码安装openresty相关的知识,希望对你有一定的参考价值。

Openresty 官网

http://openresty.org

Openresty源码下载页面

http://openresty.org/en/download.html

Openresty 简易安装说明页面

http://openresty.org/en/installation.html

 

安装步骤如下

yum install gcc gcc-c++ make automake autoconf libtool -y


if [ ! -d "/usr/local/software" ]; then mkdir /usr/local/software
fi

cd /usr/local/software

if [ ! -f "/usr/local/src/openresty-1.15.8.2.tar.gz" ]; then
wget https://openresty.org/download/openresty-1.15.8.2.tar.gz
fi

if [ ! -f "/usr/local/software/ngx_http_upstream_check_module.tar.gz" ]; then
wget http://download.zhufunin.com/ngx_http_upstream_check_module.tar.gz
fi

if [ ! -f "/usr/local/software/nginx-upstream-dynamic-servers-master.zip" ]; then
wget http://download.zhufunin.com/nginx-upstream-dynamic-servers-master.zip
fi

if [ ! -f "/usr/local/software/libmaxminddb-1.3.2.tar.gz" ]; then
wget http://download.zhufunin.com/libmaxminddb-1.3.2.tar.gz
fi

if [ ! -f "/usr/local/software/maxmind-city.mmdb.tar.gz" ]; then
wget http://download.zhufunin.com/maxmind-city.mmdb.tar.gz
fi

if [ ! -f "/usr/local/software/openssl-1.1.0e.tar.gz" ]; then
wget http://download.zhufunin.com/openssl-1.1.0e.tar.gz
fi

if [ ! -f "/usr/local/software/pcre-8.42.tar.gz" ]; then
wget http://download.zhufunin.com/pcre-8.42.tar.gz
fi

if [ ! -f "/usr/local/software/zlib-1.2.11.tar.gz" ]; then
wget http://download.zhufunin.com/zlib-1.2.11.tar.gz
fi

if [ ! -f "/usr/local/software/ngx_http_geoip2_module.zip" ]; then
wget http://download.zhufunin.com/ngx_http_geoip2_module.zip
fi

tar zxvf openresty-1.15.8.2.tar.gz
unzip -o nginx-upstream-dynamic-servers-master.ziptar zxvf ngx_http_upstream_dynamic_module.tar.gz
tar zxvf libmaxminddb-1.3.2.tar.gz
tar zxvf maxmind-city.mmdb.tar.gz
tar zxvf openssl-1.1.0e.tar.gz
tar zxvf pcre-8.42.tar.gz
tar zxvf zlib-1.2.11.tar.gz
unzip -o ngx_http_geoip2_module.zip

cd ./libmaxminddb-1.3.2
./configure
make && make install
[[ -z `cat /etc/ld.so.conf |grep "/usr/local/lib"` ]] && echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig

cd ../openresty-1.15.8.2
./configure --user=www --group=www --prefix=/usr/local --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_gunzip_module --with-http_stub_status_module --with-http_realip_module --with-pcre-jit --with-stream --with-http_v2_module --with-http_iconv_module --with-threads --with-openssl=/usr/local/software/openssl-1.1.0e --with-zlib=/usr/local/software/zlib-1.2.11 --with-pcre=/usr/local/software/pcre-8.42 --error-log-path=/usr/local/nginx/logs/error.log --http-log-path=/usr/local/nginx/logs/access.log --http-client-body-temp-path=/usr/local/nginx/tmp/client_body --http-proxy-temp-path=/usr/local/nginx/tmp/proxy --http-fastcgi-temp-path=/usr/local/nginx/tmp/fastcgi --http-uwsgi-temp-path=/usr/local/nginx/tmp/uwsgi --http-scgi-temp-path=/usr/local/nginx/tmp/scgi --with-ld-opt="-Wl,-rpath,/usr/local/lib" --with-luajit --add-module=/usr/local/software/ngx_http_geoip2_module-master --add-module=/usr/local/software/ngx_http_upstream_check_module --add-module=/usr/local/software/nginx-upstream-dynamic-servers-master --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module -j2

make -j2

sudo make install

 

./configure -j2

make -j2

 

j2代表双核处理,如果CPU是4核,可以写出j4

 

以上是关于centos 7 源码安装openresty的主要内容,如果未能解决你的问题,请参考以下文章

验证 Openresty+Lua+GraphicsMagick

centos7.0安装OpenResty

centos yum 安装openresty

centos7通过yum安装Openresty

Centos7安装Openresty

OpenResty安装使用教程(CentOS 6)