zoukankan      html  css  js  c++  java
  • linux安装nginx 简单版

    1安装依赖包

    安装pcre
    yum install pcre*

    安装openssl
    yum install openssl*

    安装zlib
    yum install zlib
    yum install zlib-devel

    安装gcc
    yum -y install gcc automake autoconf libtool make
    yum install gcc gcc-c++

    2安装nginx

    下载

    wgt http://nginx.org/download/nginx-1.19.0.tar.gz

    解压缩。
    tar  -xvzf  nginx-1.19.0.tar.gz

    检查编译
    ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/opt/soft/openssl-1.1.1g

    (其中/opt/soft/openssl-1.1.1g是你本地安装的openssl路径,如果不加这些参数,则编译通过但 make时报错No rule to make target `/usr/local/ssl/include/openssl/ssl.h', needed by `objs/src/core/nginx.o'. Stop.)

    编译

    make

    安装

    make install

    make出现如下错误时

    [root@localhost nginx-1.19.1]# make
    make -f objs/Makefile
    make[1]: Entering directory `/opt/nginx-1.19.1'
    cd /usr/local/ssl
    && if [ -f Makefile ]; then make clean; fi
    && ./config --prefix=/usr/local/ssl/.openssl no-shared no-threads
    && make
    && make install_sw LIBDIR=lib
    /bin/sh: line 2: ./config: No such file or directory
    make[1]: *** [/usr/local/ssl/.openssl/include/openssl/ssl.h] Error 127
    make[1]: Leaving directory `/opt/nginx-1.19.1'
    make: *** [build] Error 2

    解决方案

    找到/opt/nginx/nginx-1.19.1/auto/lib/openssl/conf 中

    CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
    CORE_DEPS="$CORE_DEPS $OPENSSL//.openssl/include/openssl/ssl.h"
    CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
    CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
    CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
    CORE_LIBS="$CORE_LIBS $NGX_LIBPTHREAD"

    改为 (去掉多余/.openssl)
    CORE_INCS="$CORE_INCS $OPENSSL/include"
    CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"
    CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libssl.a"
    CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libcrypto.a"
    CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
    CORE_LIBS="$CORE_LIBS $NGX_LIBPTHREAD"

  • 相关阅读:
    python上传阿里云oss
    python调用百度图片识别api
    python实现sm2和sm4国密(国家商用密码)算法
    python坐标获取经纬度或经纬度获取坐标免费模块--geopy
    剑指 Offer 36. 二叉搜索树与双向链表
    vs code中终端中的命令不能使用的解决方法
    VS Code切换默认终端(cmd、powershell)
    剑指 Offer 35. 复杂链表的复制
    剑指 Offer 33. 二叉搜索树的后序遍历序列
    剑指 Offer 32
  • 原文地址:https://www.cnblogs.com/rdchen/p/13408769.html
Copyright © 2011-2022 走看看