Ubuntu22.04 编译安装nginx
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.
缺少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.
安装缺少依赖
apt-get install gcc -y
apt-get install libpcre3-dev -y
apt-get install zlib1g zlib1g-dev -y
apt-get install openssl libssl-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
访问(防火墙确保已经关闭)

5、安装成系统服务
# 新建系统服务文件
# vi /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx - web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
ExecQuit=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
停止原来的nginx,使用systemd启动

Ubuntu22.04 编译安装nginx的更多相关文章
- ubuntu 12.04 编译安装 nginx
下载源码包 nginx 地址:http://nginx.org/en/download.html 编译前先安装两个包: 直接编译安装会碰到缺少pcre等问题,这时候只要到再安装两个包就ok sudo ...
- ubuntu 14.04 编译安装 nginx
下载源码包 nginx 地址:http://nginx.org/en/download.html 下载nginx 1.4.7 编译前先安装两个包: 直接编译安装会碰到缺少pcre等问题,这时候只要到 ...
- Ubuntu 16.04源码编译安装nginx 1.10.0
一.下载相关的依赖库 pcre 下载地址 http://120.52.73.43/jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.t ...
- ubuntu10.04编译安装LAMP
ubuntu10.04编译安装LAMP以及简单wordpress的使用 : http://linuxme.blog.51cto.com/1850814/971631 一.源码安装LAMP 网上有一堆关 ...
- Ubuntu16.04编译安装php
#Ubuntu16.04编译安装php Ubuntu16.04上面搭建基于Nginx的php服务.Nginx使用apt直接安装的. sudo apt install nginx php的安装部署步骤主 ...
- Ubuntu编译安装nginx以及配置自动启动
本文主要介绍ubuntu如何编译安装nginx以及遇到的问题 和 配置系统自动启动服务 查看操作系统版本 cat /etc/issue Ubuntu 18.04.3 LTS \n \l 更改镜 ...
- centos系统编译安装nginx+php环境另加独立mysql教程
以前看过的安装nginx+php环境都带了mysql数据库了,这个是因为很多站长都是nginx+php+mysql都在同一台服务器了,那么今天我们是单独处理了,一个是nginx+php环境,然后mys ...
- Centos7 编译安装 Nginx PHP Mariadb Memcached 扩展 ZendOpcache扩展 (实测 笔记 Centos 7.3 + Mariadb 10.1.20 + Nginx 1.10.2 + PHP 7.1.0 + Laravel 5.3 )
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...
- CentOS7 编译安装 Nginx (实测 笔记 Centos 7.0 + nginx 1.6.2)
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...
- Ubuntu 16.04 LTS 安装 Nginx/PHP 5.6/MySQL 5.7 (LNMP) 与Laravel
Ubuntu 16.04 LTS 安装 Nginx/PHP 5.6/MySQL 5.7 (LNMP) 与Laravel 1.MySQL安装[安装 MariaDB]MariaDB是MySQL的一个分支首 ...
随机推荐
- GTX.Zip:一款可以替代 gzip 的基因大数据压缩软件
今天给大家推荐一款基因大数据压缩的大杀器:GTX.Zip. GTX.Zip 这款软件是由曾在 2016 年 GCTA 风云挑战赛中的那匹黑马--人和未来生物科技有限公司开发的,而当时他们也是打破了基因 ...
- 整理spring-web里支持的文件以及对应的Content-Type
前言 最近在弄文件上传.下载.在线预览时经常需要设置请求标头或者响应标头的Content-Type 属性.所以研究了一下spring支持哪些Content-Type,通过研究MediaTypeFact ...
- Jconsole 开启远程连接遇到的一些坑
最近在学习 JVM,其中涉及到性能.内存等指标分析需要使用工具分享,Java 提供了几个可视化工具来监控和管理 Java 应用,比如 Jconsole.JVisual.JMC,他们以图形化的界面实时的 ...
- 组合数学_第4章_Polya定理
第4章 Polya定理 4.1 群的概念 4.1.1 群的定义 给定一个集合\(G=\{a,b,c,\cdots\}\)和集合\(G\)上的二元运算"\(\cdot\)",并满足下 ...
- PostgreSQL 12 文档: 部分 VI. 参考
部分 VI. 参考 这份参考中的条目意欲提供关于相应主题的权威.完整和正式的总结.关于使用PostgreSQL的更多信息(以叙述.教程或例子的形式)可以在本书的其他部分找到.见每个参考页面上列出的交叉 ...
- WPF复习知识点记录
WPF复习知识点记录 由于近几年主要在做Web项目,客户端的项目主要是以维护为主,感觉对于基础知识的掌握没有那么牢靠,趁着这个周末重新复习下WPF的相关知识. 文章内容主要来自大佬刘铁锰老师的经典著作 ...
- linux grep基本用法--九五小庞
通过此语句可以查询一个文件或者当前目录下所有文件中包含exception和error的文件 grep -E -i "((exception)|(error))" * 1.查找文件中 ...
- 深度解读AIGC存储解决方案
5月26日,2023数据基础设施技术峰会在苏州举办,腾讯云首席存储技术专家温涛受邀出席并分享了腾讯云领先的存储技术在AIGC场景中的应用,通过对AIGC业务流程和场景的提炼,从内容生成.内容审核和内容 ...
- 国标GB28181协议客户端开发(四)实时视频数据传输
国标GB28181协议客户端开发(四)实时视频数据传输 本文是<国标GB28181协议设备端开发>系列的第四篇,介绍了实时视频数据传输的过程.通过解读INVITE报文中的SDP信息,读取和 ...
- 打包 IPA processing failed 失败
查看报错日志:有些SDK含有x86_64架构,移除即可 1. cd 该库SDK路径下 2.执行 lipo -remove x86_64 BaiduTraceSDK -o BaiduTraceSDK 解 ...