操作系统
可使用 lsb_release -a 命令查看
LSB Version:    core-11.1.0ubuntu4-noarch:security-11.1.0ubuntu4-noarch
Distributor ID:    Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:    22.04
Codename:    jammy下载nginx
安装nginx
在线安装
apt install nginx编译安装
安装依赖软件
yum -y install openssl openssl-devel make zlib zlib-devel gcc gcc-c++ libtool pcre pcre-devel 安装nginx
# 如,下载nginx-1.25.5.tar.gz 版本,上传安装包至指定目录,如:/home/package
cd /home/package
# 解压至/home目录下
tar -zxvf nginx-1.25.5.tar.gz
# 执行编译命令
cd /home/package/nginx-1.25.5
./configure --user=nginx --prefix=/usr/local/nginx --with-http_ssl_module --with-http_realip_module --with-http_image_filter_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --without-http_rewrite_module --with-openssl=/usr/bin/openssl
# 出现错误:./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
# 安装 OpenSSL隐藏版本号
http { 
 server_tokens off;
}