1、下载nginx软件包 https://nginx.org/en/download.html
2、压缩包上传服务器并解压缩
tar xf nginx-1.22.1.tar.gz
3、进入解压目录,编译安装
root@control01:/home/jiafeng/nginx-1.22.1# cd nginx-1.22.1
root@control01:/home/jiafeng/nginx-1.22.1# ./configure --prefix=/usr/local/nginx
checking for OS
+ Linux 5.15.0-56-generic x86_64
checking for C compiler ... not found
./configure: error: C compiler cc is not found
缺少gcc依赖
./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option.
缺少pcre依赖
./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option.
缺少zlib依赖
./configure: error: the HTTP gzip module requires the zlib library. You can either disable the module by using --without-http_gzip_module option, or install the zlib library into the system, or build the zlib library statically from the source with nginx by using --with-zlib=<path> option.
安装缺少依赖
apt-get install gcc pcre pcre-devel -y
apt-get install libpcre3-dev -y
apt-get install zlib1g zlib1g-dev -y
执行完configure成功是如上所示
接下来执行
make
make install
4、启动nginx,访问
root@control01:/home/jiafeng/nginx-1.22.1# cd /usr/local/nginx/sbin root@control01:/usr/local/nginx/sbin# ./nginx
root@control01:/usr/local/nginx/sbin# ps -ef| grep nginx
root 8351 1 0 05:39 ? 00:00:00 nginx: master process ./nginx
nobody 8352 8351 0 05:39 ? 00:00:00 nginx: worker process
root 8355 1900 0 05:39 pts/3 00:00:00 grep --color=auto nginx
访问(防火墙确保已经关闭)
标签:00,编译,--,Ubuntu22.04,library,nginx,module,install From: https://www.cnblogs.com/ggborn-001/p/17021865.html