一、下载安装
openresty 是一个基于 nginx 和 lua 的高性能 web 框架。
官方首页:https://openresty.org/cn/。
下载首页:https://openresty.org/cn/download.html,当前最新版为 1.13.6.2 。
依赖库:
ubuntu: apt-get install libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl make build-essential
centos: yum install readline-devel pcre-devel openssl-devel perl
1 2 3 4 5 6 7 8 9 |
# 下载和解压 wget https://openresty.org/download/openresty-1.13.6.2.tar.gz tar -zxvf openresty-1.13.6.2.tar.gz cd openresty-1.13.6.2 # 配置 configure ./configure \ --prefix=/usr/local/openresty-1.13.6.2 \ --with-luajit --without-http_redis2_module \ --with-http_iconv_module |
如果不出意外将会出现:
1 2 3 |
Type the following commands to build and install: gmake gmake install |
此时按照要求输入 gmake && gmake install
即可完成安装了。
二、替换原有 nginx
openresty 自带了 nginx 程序,安装好后的主目录下就有 nginx 的安装程序,如果本机已经安装了 nginx,则可以考虑用本机的替换掉自带的,但是目前不确定这个想法是否可行,理论分析没问题。
1 2 3 4 5 6 |
ln -s /usr/local/openresty-1.13.6.2 /usr/local/openresty cd /usr/local/openresty # 备份自带的 nginx mv nginx nginx.bak # 替换成自己的 nginx,通过软链接的方式 ln -s /usr/local/nginx /usr/local/openresty/nginx |
评论