Nginx系列1:ubuntu16.04编译出适合自己的nginx服务器

1.下载nginx

nginx官网:nginx.org

tar.gz文件 解压缩命令:

wget https://nginx.org/download/nginx-1.14.2.tar.gz  #下载nginx最新版本
tar -xzf nginx-1.14.2.tar.gz                 #解压缩nginx

 

2.编译nginx

cd nginx-1.14.2                  # 进入nginx-1.14.2文件夹
./configure --prefix=/home/zopen/nginx      # /home/zopen/nginx改为自己指定的位置

注意: 执行后会提示:error: the HTTP rewrite module requires the PCRE library

解决办法:需要安装pcre包

sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev

 

重新运行编译指令

./configure --prefix=/home/zopen/nginx      # /home/zopen/nginx改为自己指定的位置

make install

 安装完成。

在/home/zopen/nginx/sbin目录下执行./nginx,开启nginx服务器,如下图所示: 

原文地址:https://www.cnblogs.com/zkfopen/p/10118627.html