nginx安装
1.apt换源
copy一份源文件
sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak
vim 文件
sudo vim /etc/apt/sources.list.d/ubuntu.sources
原本文件内容
Types: deb URIs: http://cn.archive.ubuntu.com/ubuntu/ Suites: noble noble-updates noble-backports Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg Types: deb URIs: http://security.ubuntu.com/ubuntu/ Suites: noble-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
阿里源 `Types: deb` `URIs: http://mirrors.aliyun.com/ubuntu/` `Suites: noble noble-updates noble-security` `Components: main restricted universe multiverse` `Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg` # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 Types: deb URIs: http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ Suites: noble noble-updates noble-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg Types: deb URIs: http://mirrors.163.com/ubuntu/ Suites: noble noble-updates noble-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
更新源列表,输入以下命令:
sudo apt-get update
如果需要,可以更新系统软件包,输入以下命令:
sudo apt-get upgrade
1.安装make
apt-get install -y make
2.安装gcc ,g++
apt install build-essential apt install gcc apt install g++
3.安装zlib1g zlib1g.dev
`$ sudo apt-get install zlib1g
$ sudo apt-get install zlib1g.dev`
4.安装libtool,openssl openssl-devel
apt install libtool
apt-get install libssl-dev
5.安装 pcre
下载安装包
wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
解压
tar -zxvf pcre-8.35.tar.gz
./configure make$$make install 安装
6.下载解压安装nginx
1、上传解压 [root@zyl-server ~]# tar -zxvf nginx-1.24.0.tar.gz -C /usr/local/src/
2、进入安装包目录 [root@zyl-server ~]# cd /usr/local/src/nginx-1.24.0/ 3、编译安装 --with-http_ssl_module 启用ngx_http_ssl_module支持 [root@zyl-server nginx-1.24.0]# ./configure --with-http_ssl_module
[root@zyl-server nginx-1.24.0]# make && make install