ubuntu编译安装nginx
时间: 2024-01-25 10:12:22 浏览: 96
ubuntu下编译安装nginx
以下是在Ubuntu系统上编译安装Nginx的步骤:
1. 安装依赖库:
```shell
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install zlib1g zlib1g-dev
sudo apt-get install libssl-dev
```
2. 下载Nginx源码:
```shell
wget http://nginx.org/download/nginx-1.18.0.tar.gz
tar -zxvf nginx-1.18.0.tar.gz
cd nginx-1.18.0
```
3. 配置编译参数:
```shell
./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/local/nginx/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_gzip_static_module \
--with-http_stub_status_module
```
4. 编译和安装:
```shell
make
sudo make install
```
5. 启动Nginx:
```shell
sudo /usr/local/nginx/sbin/nginx
```
现在,您已经成功在Ubuntu系统上编译安装了Nginx。
阅读全文