美文网首页
Nginx在CentOS7的安装配置

Nginx在CentOS7的安装配置

作者: 飞狗未来 | 来源:发表于2018-07-27 20:02 被阅读0次

    安装依赖

    yum -y install pcre-devel openssl-devel zlib-devel

    创建用户和组

    groupadd nginx
    useradd -r -g nginx -s /bin/false nginx
    

    编译安装

    ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_flv_module --with-http_gzip_static_module --with-http_ssl_module --with-http_flv_module
    make && make install

    配置为服务

    ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/
    nginx –t
    vim /etc/init.d/nginx

    #!/bin/bash
    # chkconfig: 2345 99 20
    # description: Nginx Server Control Script
    PROG="/usr/local/nginx/sbin/nginx"
    PIDF="/usr/local/nginx/logs/nginx.pid"
    case "$1" in
            start)
                    $PROG
                    ;;
            stop)
                    kill -s QUIT $(cat $PIDF)
                    ;;
            restart)
                    $0 stop
                    $0 start
                    ;;
            reload)
                    kill -s HUP $(cat $PIDF)
                    ;;
            *)
                    echo "Usage: $0 (start|stop|restart|reload)"
            exit 1
    esac
    exit 0
    

    问题1

    问题描述:

    make[1]: *** [/home/zcty/nginx-1.15.1/auto/lib/openssl/.openssl/include/openssl/ssl.h] 错误 127

    解决方案:

    打开nginx源文件下的/usr/local/src/nginx-1.15.1/auto/lib/openssl/conf文件:
    找到这么一段代码:
    CORE_INCS="CORE_INCSOPENSSL/.openssl/include"
    CORE_DEPS="CORE_DEPSOPENSSL/.openssl/include/openssl/ssl.h"
    CORE_LIBS="CORE_LIBSOPENSSL/.openssl/lib/libssl.a"
    CORE_LIBS="CORE_LIBSOPENSSL/.openssl/lib/libcrypto.a"
    CORE_LIBS="CORE_LIBSNGX_LIBDL"
    修改成以下代码:
    CORE_INCS="CORE_INCSOPENSSL/.openssl/include"
    CORE_DEPS="CORE_DEPSOPENSSL/include/openssl/ssl.h"
    CORE_LIBS="CORE_LIBSOPENSSL/lib/libssl.a"
    CORE_LIBS="CORE_LIBSOPENSSL/lib/libcrypto.a"
    CORE_LIBS="CORE_LIBSNGX_LIBDL"
    然后再进行Nginx的编译安装即可

    相关文章

      网友评论

          本文标题:Nginx在CentOS7的安装配置

          本文链接:https://www.haomeiwen.com/subject/xqagmftx.html