安装环境:centOS7 1810
Step1:安装编译所依赖的软件
pcre-devel: 扩展的正则表达式引擎,为了使Nginx处理更复杂的正则表达式机制
openssl-devel:–with-http_ssl_module使用该模块必需装openssl库,来实现http支持https协议
zlib-devel:zlib库是网络通信压缩库,ngx_http_gzip_module(gzip压缩模块)所必需的
readline-devel:readline是安装Openresty所必须的依赖包
[root@waf ~]# yum install gcc-c++ libtool gmake make -y [root@waf ~]# yum install pcre pcre-devel openssl openssl-devel zlib zlib-devel readline readline-devel-y
Step2:创建nginx用户/组
Nginx的Master主进程以root用户身份运行,而worker子进程我们指定它为nginx用户运行
[root@waf ~]# groupadd nginx [root@waf ~]# useradd -d /home/nginx -g nginx -s /sbin/nginx nginx
step3:编译安装Openresty
[root@waf ~]# wget https://openresty.org/download/openresty-1.17.8.2.tar.gz [root@waf ~]# tar zxvf openresty-1.17.8.2.tar.gz [root@waf ~]# cd openresty-1.17.8.2 [root@waf openresty-1.17.8.2]# ./configure --prefix=/usr/local/openresty \ --sbin-path=/usr/local/openresty/nginx/sbin/nginx \ --conf-path=/usr/local/openresty/nginx/conf/nginx.conf \ --pid-path=/usr/local/openresty/nginx/run/nginx.pid \ --error-log-path=/usr/local/openresty/nginx/logs/error.log \ --http-log-path=/usr/local/openresty/nginx/logs/access.log \ --user=nginx \ --group=nginx \ --with-pcre \ --with-stream \ --with-threads \ --with-file-aio \ --with-http_v2_module \ --with-http_ssl_module \ --with-http_realip_module \ --with-http_gzip_static_module \ --with-http_stub_status_module
[root@waf openresty-1.17.8.2]# gmake
[root@waf openresty-1.17.8.2]# gmake install