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的一个分支首 ...
随机推荐
- 从 0 到 1 搭建自己的脚手架(java 后端)
一.脚手架是什么 脚手架是一种基础设施工具,用于快速生成项目的框架代码和文件结构.它是一种标准化的开发工具,使开发人员能够在项目的早期阶段快速搭建出一个具备基本功能和结构的系统. 二.脚手架的意义 主 ...
- 【RS】多光谱波段和全色波段的区别
<p><strong>1.全色波段(Panchromatic Band)</strong></p> 全色图像是单通道的(即单波段灰色影像),其中全色是指 ...
- 【Python&GIS】矢量数据投影转换(WGS84转地方坐标系)
又是掉头发的一天,今天的任务是将WGS84坐标系的点转成地方坐标系,并判断点是否在某个面内,找了半天的资料什么四参数.七参数啥的太复杂了.这里使用Python的ogr, osr库内置的坐标转 ...
- 第一章 : Linux入门
1. 概述 2. Linux 和 Windows 区别 3. Centos 下载地址 网易镜像:http://mirrors.163.com/centos/7/isos ...
- Pinot2:一款强大的无人机操作系统
目录 1. 引言 1.1. 背景介绍 1.2. 文章目的 1.3. 目标受众 2. 技术原理及概念 2.1. 基本概念解释 2.2. 技术原理介绍 2.3. 相关技术比较 3. 实现步骤与流程 3.1 ...
- Mysql基础篇(三)之多表查询
一. 多表关系 一对多(多对一) 多对一 一对一 1. 一对多 (1). 案例:部门与员工的关系 (2). 关系:一个部门对应多个员工,一个员工对应一个部门 (3). 实现:在多的一方建立外建,指向一 ...
- 【技术积累】Mysql中的SQL语言【技术篇】【一】
数据库管理操作 创建一个新的数据库 要在MySQL中创建一个新的数据库,可以使用CREATE DATABASE语句.以下是创建新数据库的SQL语句及其解释: SQL语句: CREATE DATABAS ...
- Vue学习之认识ref
ref相当于一个dom节点,值为string 通俗将类似于原生js的document.querySelector('xxx'):但是不同的是vue是操纵虚拟dom,在渲染初期并没有这个属性,而是在创建 ...
- 学习jQuery核心内容这一篇就够了
jQuery 1. 介绍 jQuery是JavaScript的工具库,对原生JavaScript中的DOM操作.事件处理.数据处理等进行封装,提供更便捷的方法. 让我们用更少的代码完成我们的js操作 ...
- quarkus实战之一:准备工作
欢迎访问我的GitHub 这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos 关于<quarkus实战>系列 <q ...