linux 编译安装 nginx
–yum方式安装依赖
1、安装依赖
yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
2、编译安装nginx
cd /usr/local
tar -xzvf nginx-1.20.2.tar.gz
cd nginx-1.20.2
./configure –prefix=/usr/local/nginx –with-http_ssl_module
make
make install
说明:
指定安装目录参数 –prefix=/usr/local/nginx
支持https参数 –with-http_ssl_module
–手动方式安装依赖
1、安装依赖
cd /usr/local/lib
tar -xzvf pcre-8.43.tar.gz
tar -xzvf zlib-1.2.11.tar.gz
tar -xzvf openssl-1.1.1w.tar.gz
2、编译安装nginx
cd /usr/local
tar -xzvf nginx-1.20.2.tar.gz
cd nginx-1.20.2
./configure –prefix=/usr/local/nginx –with-http_ssl_module –with-pcre=/usr/local/lib/pcre-8.43 –with-zlib=/usr/local/lib/zlib-1.2.11 –with-openssl=/usr/local/lib/openssl-1.1.1w
make
make install
–常用命令
cd /usr/local/nginx/sbin
./nginx #启动
./nginx -t #测试配置文件是否正确
./nginx -s reload #重新加载配置文件
./nginx -s stop #停止
./nginx -V #查看版本和编译选项
转载请注明作者和出处,并添加本页链接。
原文链接:
//jiaoqiang.top/post/55