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的一个分支首 ...
随机推荐
- 如何同步更新 Github 上 Fork 的项目?
Github Fork 过程概述 在 Github 上有很多优秀的开源项目,相信每一位热衷于技术的朋友都会在 Github 上 Fork 一些感兴趣的项目,然后在本地修改并提交.本文以 Galaxy ...
- 使用poi-tl导出word文件的几个技巧
1.前言 Poi-tl提供了基于word模板文件导出word文件的功能.文档地址:http://deepoove.com/poi-tl/. 用下来,总体感觉还是很方便的.但使用过程,有几个细节 ...
- 浏览器输入URL到网页完全呈现的过程
前言 临近计算机网络期末考试, 最近在复习(预习), 写一遍博客讲解加深印象. 浏览器输入URL过程图 浏览器输入 URL 过程: 当用户在网页上输入网址 URL 后, 浏览器会对网址进行 DNS 域 ...
- C#里的var和dynamic区别到底是什么,你真的搞懂了嘛
前言 这个var和dynamic都是不确定的初始化类型,但是这两个本质上的不同.不同在哪儿呢?var编译阶段确定类型,dynamic运行时阶段确定类型.这种说法对不对呢?本篇看下 概括 以下详细叙述下 ...
- CtfShow信息收集1-20攻略
CtfShow信息收集1-20关攻略 简单更新一下CTF关于信息收集的题目,总共20道,网站地址:https://ctf.show/challenges 第一关 我们可以看到提示:开发注释没有及时删除 ...
- 【QCustomPlot】使用方法(动态库方式)
说明 使用 QCustomPlot 绘图库辅助开发时整理的学习笔记.同系列文章目录可见 <绘图库 QCustomPlot 学习笔记>目录.本篇介绍 QCustomPlot 的一种使用方法, ...
- 学生课程分数的Spark SQL分析
读学生课程分数文件chapter4-data01.txt,创建DataFrame. url = "file:///D:/chapter4-data01.txt" rdd = spa ...
- Oracle将用户权限移植到另一个用户上
问题描述:往往有些需求,A用户依赖于B用户创建,A用户想要获取B用户的权限,oracle没找到有命令可以直接继承,只能写一些语句来代替 1.查询用户下的权限有哪些 SET PAGESIZE 100 S ...
- GetX 关于报错 Null check operator used on a null value的解决
import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'logic.dart'; class Ge ...
- C# Task 实现任务超时取消、超时取消然后重试 超过重试最大次数就结束。
任务超时取消 示例 public static async Task TimeoutCancelTask() { CancellationTokenSource cts = new Cancellat ...