linux源码安装nginx
时间: 2023-12-20 21:32:00 浏览: 105
nginx linux版本安装源码nginx-1.21.6.tar
以下是在Linux上源码编译安装Nginx的步骤:
1. 下载Nginx源码包
```shell
wget https://nginx.org/download/nginx-1.20.2.tar.gz
```
2. 解压源码包
```shell
tar -zxvf nginx-1.20.2.tar.gz
```
3. 安装编译依赖
```shell
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev
```
4. 进入解压后的Nginx目录
```shell
cd nginx-1.20.2
```
5. 配置编译参数
```shell
./configure
```
6. 编译源码
```shell
make
```
7. 安装编译后的Nginx
```shell
sudo make install
```
8. 启动Nginx服务
```shell
sudo /usr/local/nginx/sbin/nginx
```
9. 验证Nginx是否成功安装
```shell
ps -ef | grep nginx
```
阅读全文