1. 下载源码
下载页面:https://nginx.org/en/download.html
下载地址:https://nginx.org/download/nginx-1.27.2.tar.gz
curl -O https://nginx.org/download/nginx-1.27.2.tar.gz
2. 依赖配置
sudo apt install gcc make libpcre3-dev zlib1g-dev openssl libssl-dev
3. 编译
解压源代码:
tar -zxvf nginx-1.27.2.tar.gz
生成编译脚本:
cd nginx-1.27.2/ ./configure --prefix=/usr/local/nginx --with-http_ssl_module
编译:
make
编译完成:
安装
make install
查看验证:
ls /usr/local/nginx ls /usr/local/nginx/sbin/ sudo /usr/local/nginx/sbin/nginx -t