nginx install

本文档详细记录了Nginx的下载、安装过程,包括依赖库pcre、openssl和zlib的安装。在安装过程中遇到了C++编译器缺失、动态库找不到等问题,并给出了相应的解决方案,如安装gcc-c++、创建软链接等。最后,展示了Nginx的配置参数,确保了防火墙未阻止80端口。
摘要由CSDN通过智能技术生成

下載

wget http://nginx.org/download/nginx-1.19.6.tar.gz

安裝

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module 

make && make install

安装第3方库

安裝pcre


#!/bin/bash
pcre_version="8.36"

pcre_url="http://jaist.dl.sourceforge.net/project/pcre/pcre/"$pcre_version"/pcre-"$pcre_version".tar.gz"
wget $pcre_url

./configure
make && make install


安裝open_ssl

#!/bin/bash

openssl_version="1.1.1"

echo "下载:openssl-"$openssl_version""
openssl_url="http://www.openssl.org/source/openssl-"$openssl_version".tar.gz"
wget $openssl_url

tar -zxvf openssl-"$openssl_version".tar.gz

./config
make && make install

安装zlib

#!/bin/bash
zlib_version="1.2.11"
echo "下载:zlib-"$zlib_version""
zlib_url="http://zlib.net/zlib-"$zlib_version".tar.gz"
wget $zlib_url
echo "解压:zlib-"$zlib_version".tar.gz"
tar -zxvf zlib-"$zlib_version".tar.gz
echo "进入目录:zlib-"$zlib_version""
cd zlib-"$zlib_version"

./configure
make && make install

問題

問題1

configure: error: You need a C++ compiler for C++ support.

yum -y install gcc-c++

问题2

./nginx: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
已经装了openssl的情况下还报这个错

# find / -name libssl.so.1.1
# 我知道具体的安装目录
# 返回/software/openssl-1.1.1/libssl.so.1.1
find /software -name libssl.so.1.1

解决

ln -s /software/openssl-1.1.1/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /software/openssl-1.1.1/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

问题3

nginx启动了,发现访问不了,有可能是Linux防火墙已经开启, 把80端口屏蔽了

配置

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
./configure
    --sbin-path=/usr/local/nginx/nginx
    --conf-path=/usr/local/nginx/nginx.conf
    --pid-path=/usr/local/nginx/nginx.pid
    --with-http_ssl_module
    --with-pcre=../pcre-8.44
    --with-zlib=../zlib-1.2.11
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值