Hi!请登陆

LNMP下使用Openresty替换Nginx

2023-2-11 169 2/11

LNMP下使用Openresty替换Nginx

下载工具

yum install -y yum-utils

配置镜像

yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo

安装OpenResty

yum install -y openresty

copy nginx conf文件夹

mv /usr/local/openresty/nginx/conf /usr/local/openresty/nginx/conf.back

cp -R /usr/local/nginx/conf/ /usr/local/openresty/nginx/

停止使用lnmp 一键安装的nginx 并启用openresty nginx

# 关闭old nginx
/etc/init.d/nginx stop

# 启用新nginx
/usr/local/openresty/nginx/sbin/nginx

# 修改/etc/inti.d/nginx nginx 路径
NGINX_BIN='/usr/local/openresty/nginx/sbin/nginx'
CONFIG='/usr/local/openresty/nginx/conf/nginx.conf'

# 覆盖/usr/bin/nginx
cp /usr/local/openresty/nginx/sbin/nginx /usr/bin/

相关推荐