教你如何用openresty完美替换nginx

  导读      <强>本文教你如何用openresty完美替换nginx。                  <>以前wget  https://openresty.org/download/openresty-1.15.8.1.tar.gz   tar  zxvf  openresty-1.15.8.1.tar.gzcd  openresty-1.15.8.1               

查看当前nginx的编译配置

  <>以前nginx  - v   

如下所示,“配置arguments"就是编译nginx时的配置

  
 nginx 版本:,nginx/1.14.0built  by  gcc  4.8.5  20150623, (Red  Hat  4.8.5-39), (GCC),
  built  with  OpenSSL  1.0.2k-fips , 26, Jan  2017 tls  SNI  support 启用
  时间参数:configure ——with-http_ssl_module 
  

编译openresty,把刚才的配置加到“configure"   命令后方,如果需要使用lua也可以加上“——with-luajit"

  <>之前。/configure ——with-http_ssl_module ——with-luajit   gmake ,,, gmake 安装   

gmake即GNU,使用它的原因是非GNU平台可能占用了   命令,在   linux系统下不用考虑这个问题.GNU,在Unix系统发明后,开始出现闭源收费软件,于是有人发起了自由软件的计划,即GNU计划,宣扬开源精神,编辑器Emacs和编译器GCC就属于GNU下的项目,但是GNU下缺少系统内核,后来机缘巧合地与   Linux进行了合作,发布了GNU/Linux。

              

把原有nginx配置文件移动到openresty目录

  <>以前mv /usr/地方/nginx/conf/* .conf /usr/地方/openresty/conf   mv /usr/地方/nginx/conf/conf.d /usr/地方/openresty/conf               <>以前nginx  -s 停止               
/usr/地方/openresty/bin/openresty 
  

如果提示“nginx:[警告]“ssl"指令已被弃用,使用“听……ssl"“原因是nginx1.15版本及以后已经不需要使上用ssl命令了,可以去掉。

              

如果觉得命令使用不方便可以直接软链接到本目录,并改名为nginx

  <>以前ln  -s /usr/地方/openresty/bin/openresty /usr/地方/bin/nginx   
  

原文来自:   https://www.linuxprobe.com/openresty-nginx.html

  

  

教你如何用openresty完美替换nginx