1. 程式人生 > >ubuntu16.04編譯自己的nginx伺服器

ubuntu16.04編譯自己的nginx伺服器

1.下載nginx

nginx官網:nginx.org

 

tar.gz檔案 解壓縮命令:

tar -xzf nginx-1.14.2.tar.gz

 

2.編譯nginx

./configure --preifx=/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 --preifx=/home/zopen/nginx      /home/zopen/nginx改為自己指定的位置

make install

 安裝完成。

在/home/zopen/nginx/sbin目錄下執行./nginx,開啟nginx伺服器,如下圖所示: