nginx源码g编译安装
时间: 2023-10-12 07:38:30 浏览: 55
好的,下面是 nginx 源码的编译安装步骤:
1. 下载 nginx 源码包并解压。
```
wget http://nginx.org/download/nginx-1.21.1.tar.gz
tar zxvf nginx-1.21.1.tar.gz
cd nginx-1.21.1
```
2. 安装编译环境和依赖库。
```
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install zlib1g-dev
sudo apt-get install openssl libssl-dev
```
3. 配置 nginx 编译选项。
```
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module
```
其中,--prefix 指定 nginx 的安装路径,--with-http_ssl_module 和 --with-http_stub_status_module 开启 SSL 和状态监控模块。
4. 编译并安装 nginx。
```
make
sudo make install
```
5. 启动 nginx。
```
sudo /usr/local/nginx/sbin/nginx
```
这样就完成了 nginx 源码的编译安装。当然,你可以根据自己的需求在配置时添加更多的编译选项。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)