• centos 7 nginx迁移到openresty


    原文地址: centos 7 nginx迁移到openresty

    欢迎访问我的博客: http://blog.duhbb.com/

    安装 openresty

    下载部署包:openresty_centos7.zip, 包的话搜一下应该到处都有吧!

    安装 openresty:

    rpm -ivh openresty-*.rpm --force --nodeps
    

    备份 nginx 配置 (本操作将会终止 nginx 服务, 请确认无误后继续操作):

    service nginx stop
    mv /etc/nginx /etc/nginx_nginx
    mv /usr/sbin/nginx /usr/sbin/nginx_nginx
    mv /usr/lib/systemd/system/nginx.service /usr/lib/systemd/system/nginx.service_nginx
    

    配置 openresty

    # 配置 openresty 配置文件
    ln -s /usr/local/openresty/nginx/conf /etc/nginx
    
    # 创建一个目录
    mkdir conf.d
    cp -a /etc/nginx_nginx/conf.d/*.conf /etc/nginx/conf.d/
    
    # 备份 nginx 配置文件
    mkdir /etc/nginx/conf.d/backup
    cp -a /etc/nginx_nginx/nginx.conf /etc/nginx/conf.d/backup/
    cp -a /etc/nginx_nginx/conf.d /etc/nginx/conf.d/backup/
    
    # 配置 openresty 服务
    ln -s /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx
    ln -s /usr/lib/systemd/system/openresty.service /usr/lib/systemd/system/nginx.service
    systemctl daemon-reload
    
    # 关闭 nginx 开机启动, 开启 openresty 开机启动
    systemctl disable nginx
    systemctl enable openresty
    

    将原来的 nginx 的 *.conf 的配置文件迁移过来如果没有生效, 可以看下 nginx.conf 这个文件是否把之前的 *.conf 文件引入进来了.

        sendfile        on;
        tcp_nopush     on;
        server_tokens off;
        keepalive_timeout  65;
        gzip  on;
        gzip_min_length 1024;
        gzip_buffers 32 4k;
        gzip_comp_level 6;
        gzip_types text/plain application/javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png image/vnd.microsoft.icon image/x-icon;
        gzip_vary off;
        gzip_disable "MSIE [1-6]\.";
        # 包含分散配置的文件
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/conf.d/*.upstream;
        include /etc/nginx/conf.d/healthcheck.lua;
    

    原文地址: centos 7 nginx迁移到openresty

    欢迎访问我的博客: http://blog.duhbb.com/

  • 相关阅读:
    2018 eclipse安装反编译插件
    Buffer flip()方法
    区块链2
    Mist 转移默认区块存储位置方法
    区块链1
    如何在Ubuntu下安装”.deb“、”.bin“、”.tar.gz“、”.tar.bz2“格式的软件包!
    eclipse 性能调优之内存分配
    linux中搭建java开发环境
    在 Ubuntu 14.04 上安装 Ubuntu Tweak 0.8.8
    Ubuntu各个版本的介绍
  • 原文地址:https://www.cnblogs.com/tuhooo/p/16330136.html
Copyright © 2020-2023  润新知