您好,欢迎访问一九零五行业门户网

openresty怎么替换nginx

openresty又被称为ngx_openresty,是基于nginx的核心web应用程序服务器,openresty是基于nginx和lua的高性能web平台,openresty通过汇聚各种设计精良的nginx模块,从而将nginx有效地变成一个强大的通用web应用平台。
下载openrestywget https://openresty.org/download/openresty-1.15.8.1.tar.gztar zxvf openresty-1.15.8.1.tar.gzcd openresty-1.15.8.1
安装openresty查看当前nginx的编译配置
nginx -v
如下所示,”configure arguments”就是编译nginx时的配置
nginx version: 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 2017tls sni support enabledconfigure arguments: --with-http_ssl_module
编译openresty,把刚才的配置加到”configure”命令后方,如果需要使用lua也可以加上”–with-luajit”
./configure --with-http_ssl_module --with-luajitgmake && gmake install
gmake即gnu make,使用它的原因是非gnu平台可能占用了make命令,在linux系统下不用考虑这个问题。gnu,在unix系统发明后,开始出现闭源收费软件,于是有人发起了自由软件的计划,即gnu计划,宣扬开源精神,编辑器emacs和编译器gcc就属于gnu下的项目,但是gnu下缺少系统内核,后来机缘巧合地与linux进行了合作,发布了gnu/linux。
更换配置文件把原有nginx配置文件移动到openresty目录
mv /usr/local/nginx/conf/*.conf /usr/local/openresty/confmv /usr/local/nginx/conf/conf.d /usr/local/openresty/conf
停止原nginxnginx -s stop
启动openresty/usr/local/openresty/bin/openresty
如果提示”nginx: [warn] the “ssl” directive is deprecated, use the “listen … ssl””,原因是nginx1.15版本及以后已经不需要使用ssl on命令了,可以去掉。
软链接到bin目录如果觉得命令使用不方便可以直接软链接到bin目录,并改名为nginx
ln -s /usr/local/openresty/bin/openresty /usr/local/bin/nginx
以上就是openresty怎么替换nginx的详细内容。
其它类似信息

推荐信息