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"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

爱跳舞的程序员.

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值