准备安装包
如下所示
[root@localhost opt]# ls -l
total 17112
-rw-r--r--. 1 root root 5653425 Dec 24 04:44 openresty-1.21.4.2.tar.gz
-rw-r--r--. 1 root root 8350547 Dec 24 04:44 openssl-1.1.1a.tar.gz
-rw-r--r--. 1 root root 1996552 Dec 24 04:44 pcre-8.35.tar.gz
drwxr-xr-x. 2 root root 6 Oct 30 2018 rh
-rw-r--r--. 1 root root 1512791 Dec 24 04:44 zlib.tar.gz
[root@localhost opt]#
解压安装包
[root@localhost opt]# tar -xzf openresty-1.21.4.2.tar.gz
[root@localhost opt]# tar -xzf openssl-1.1.1a.tar.gz
[root@localhost opt]# tar -xzf pcre-8.35.tar.gz
[root@localhost opt]# tar -xzf zlib.tar.g
[root@localhost opt]# ll
total 17132
drwxrwxr-x. 5 root root 130 Jul 16 2023 openresty-1.21.4.2
-rw-r--r--. 1 root root 5653425 Dec 24 04:44 openresty-1.21.4.2.tar.gz
drwxr-xr-x. 19 root root 4096 Nov 20 2018 openssl-1.1.1a
-rw-r--r--. 1 root root 8350547 Dec 24 04:44 openssl-1.1.1a.tar.gz
drwxr-xr-x. 7 1169 1169 8192 Apr 4 2014 pcre-8.35
-rw-r--r--. 1 root root 1996552 Dec 24 04:44 pcre-8.35.tar.gz
drwxr-xr-x. 2 root root 6 Oct 30 2018 rh
drwxr-xr-x. 14 501 games 4096 Jan 22 2024 zlib-1.3.1
-rw-r--r--. 1 root root 1512791 Dec 24 04:44 zlib.tar.gz
[root@localhost opt]#
安装openssl
[root@localhost opt]# cd openssl-1.1.1a/
[root@localhost openssl-1.1.1a]#
[root@localhost openssl-1.1.1a]# ./config
Operating system: x86_64-whatever-linux2
Configuring OpenSSL version 1.1.1a (0x1010101fL) for linux-x86_64
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile
**********************************************************************
*** ***
*** OpenSSL has been successfully configured ***
*** ***
*** If you encounter a problem while building, please open an ***
*** issue on GitHub <https://github.com/openssl/openssl/issues> ***
*** and include the output from the following command: ***
*** ***
*** perl configdata.pm --dump ***
*** ***
*** (If you are new to OpenSSL, you might want to consult the ***
*** 'Troubleshooting' section in the INSTALL file first) ***
*** ***
**********************************************************************
[root@localhost openssl-1.1.1a]#
[root@localhost openssl-1.1.1a]# make
[root@localhost openssl-1.1.1a]# make install
安装 gcc-c++
[root@localhost pcre-8.35]# yum -y install gcc-c++
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00
extras | 2.9 kB 00:00
updates | 2.9 kB 00:00
(1/4): base/7/x86_64/group_gz | 153 kB 00:00
(2/4): extras/7/x86_64/primary_db | 253 kB 00:00
(3/4): updates/7/x86_64/primary_db | 27 MB 00:01
base/7/x86_64/primary_db FAILED
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/6d0c3a488c282fe537794b5946b01e28c7f44db79097bb06826e1c0c88bad5ef-primary.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
Trying other mirror.
(4/4): base/7/x86_64/primary_db | 6.1 MB 00:00
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.x86_64 0:4.8.5-44.el7 will be installed
--> Processing Dependency: libstdc++-devel = 4.8.5-44.el7 for package: gcc-c++-4.8.5-44.el7.x86_64
--> Running transaction check
---> Package libstdc++-devel.x86_64 0:4.8.5-44.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
gcc-c++ x86_64 4.8.5-44.el7 base 7.2 M
Installing for dependencies:
libstdc++-devel x86_64 4.8.5-44.el7 base 1.5 M
Transaction Summary
================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 8.7 M
Installed size: 25 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/libstdc++-devel-4.8.5-44.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for libstdc++-devel-4.8.5-44.el7.x86_64.rpm is not installed
(1/2): libstdc++-devel-4.8.5-44.el7.x86_64.rpm | 1.5 MB 00:00
(2/2): gcc-c++-4.8.5-44.el7.x86_64.rpm | 7.2 MB 00:00
--------------------------------------------------------------------------------
Total 14 MB/s | 8.7 MB 00:00
Retrieving key from http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
From : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libstdc++-devel-4.8.5-44.el7.x86_64 1/2
Installing : gcc-c++-4.8.5-44.el7.x86_64 2/2
Verifying : gcc-c++-4.8.5-44.el7.x86_64 1/2
Verifying : libstdc++-devel-4.8.5-44.el7.x86_64 2/2
Installed:
gcc-c++.x86_64 0:4.8.5-44.el7
Dependency Installed:
libstdc++-devel.x86_64 0:4.8.5-44.el7
Complete!
安装pcre
[root@localhost opt]# cd pcre-8.35/
[root@localhost pcre-8.35]#
[root@localhost pcre-8.35]# ./configure
[root@localhost pcre-8.35]# make
[root@localhost pcre-8.35]# make install
安装zlib
[root@localhost opt]# cd zlib-1.3.1/
[root@localhost zlib-1.3.1]#
[root@localhost zlib-1.3.1]# ./configure
[root@localhost zlib-1.3.1]# make
[root@localhost zlib-1.3.1]# make install
安装openresty
[root@localhost opt]# cd openresty-1.21.4.2/
[root@localhost openresty-1.21.4.2]#
[root@localhost openresty-1.21.4.2]# ./configure
[root@localhost openresty-1.21.4.2]# make
[root@localhost openresty-1.21.4.2]# make install
[root@localhost openresty-1.21.4.2]# ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
[root@localhost openresty-1.21.4.2]# ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
[root@localhost openresty-1.21.4.2]#
启动openresty
[root@localhost openresty-1.21.4.2]# cd /usr/local/openresty/nginx/sbin/
[root@localhost sbin]# ./nginx
[root@localhost sbin]#
浏览器访问本地地址:http://localhosst:80出现如下页面表示成功: