首页 > 系统相关 >Ubuntu22.04 编译安装nginx

Ubuntu22.04 编译安装nginx

时间:2023-01-03 13:55:56浏览次数:62  
标签:00 编译 -- Ubuntu22.04 library nginx module install

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

相关文章

  • Nginx 过滤url
    1、用在if中的正则表达式,下表:  说明:~匹配!~不匹配*不区分大小写这样比较好记忆。2、测试location/{if($request_uri!~"hello"){......
  • nginx快速查看配置文件的方法
    nginx的配置放在nginx.conf文件中,一般我们可以使用以下命令查看服务器中存在的nginx.conf文件。locatenginx.conf/usr/local/etc/nginx/nginx.conf/usr/local/etc/nginx/ng......
  • nginx-clojure java 集成试用
    主要是基于java开发一个简单的扩展,学习下流程java项目pom.xml<?xmlversion="1.0"encoding="UTF-8"?><projectxmlns="http://maven.apache.org/POM/4......
  • ubuntu22.04 安装nginx
    1、使用apt-get安装nginx(得机器能联网才行)#切换到root用户#切换到root用户sudo-i#更新apt源apt-getupdate#安装nginxapt-getinstallnginx-y......
  • NGINX-文件目录浏览服务
    局域网:文件服务、目录浏览、允许跨域conf/nginx.confhttp{server{}+includeservers/*.conf;}conf/servers/source.confserver{listen84;i......
  • Centos安装Nginx
    Centos安装Nginx版本区别常用版本分为四大阵营Nginx开源版Nginxplus商业版openrestyTengine编译安装先下载Nginx开源版比如:nginx-1.22.1.tar.gz借助......
  • nginx的负载均衡如何配置
    负载均衡 nginx的负载均衡有4种模式:1)、轮询(默认) 每个请求按时间顺序逐一分配到不同的后端服务器,如果后端服务器down掉,能自动剔除。 2)、weight 指定轮询几率,weight......
  • nginx-clojure docker 镜像
    主要是一个测试,方便学习使用nginx-clojure强大的能力dockerfile直接基于了openjdk:10-slim基础镜像,同时基于copy文件的格式处理FROMopenjdk:10-slimWOR......
  • folly编译
    1)问题一CouldNOTfindOpenSSL,trytosetthepathtoOpenSSLrootfolderinthe解决:apt-getinstalllibssl-dev2)问题二gtest版本低ExceptionWrapperTest.cpp:83:7:......
  • Taro多端开发及编译踩坑
    版本Tarov3.4.9@nutui/nutui-taro^3.1.20一.项目搭建1.安装​​@tarojs/cli​​​​直达地址​​2.项目初始化$taroinitmyApp3.nutui​​京东风格的轻量级移动......