Ubuntu源码安装Nginx笔记

一.准备

  • 环境:ubuntu
  • 编译环境sudo apt-get install build-essential , sudo apt-get install libtool
  • 下载Nginx和所需库: openssl-1.0.1t.tar.gz,pcre-8.39.tar.gz,zlib-1.2.8.tar.gz下载地址:
1
2
3
4
wget https://nginx.org/download/nginx-1.10.2.tar.gz
wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
wget http://zlib.net/zlib-1.2.8.tar.gz
  • 设置configure参数,设置各种路径和需要开启的功能
1
./configure --prefix=/usr/local/programs/nginx --sbin-path=/usr/local/programs/nginx/nginx --conf-path=/usr/local/programs/nginx/nginx.conf --pid-path=/var/run/nginx.pid --with-http_ssl_module --with-pcre=/usr/local/programs/src/pcre-8.39 --with-zlib=/usr/local/programs/src/zlib-1.2.8 --with-openssl=/usr/local/programs/src/openssl-1.0.1t --with-http_stub_status_module --with-http_geoip_module
  • sudo make & make install
  • 完成!