nginx-compile

源码编译Nginx

Nginx

编译步骤

  1. openssh

    1
    2
    3
    4
    $ git clone https://github.com/openssl/openssl.git /opt/openssl
    $ cd /opt/openssl
    $ git branch -a
    $ git checkout -b v_1.1.1 remotes/origin/OpenSSL_1_1_1-stable
  2. 依赖

    1
    2
    3
    4
    5
    $ sudo apt install -y build-essential \
    git tree perl libperl-dev libgd3 \
    libgd-dev libgeoip1 libgeoip-dev \
    geoip-bin libxml2 libxml2-dev \
    libxslt1.1 libxslt1-dev
  1. Nginx

    1
    $ git clone https://github.com/nginx/nginx.git /opt/nginx
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    $ cd /opt/nginx
    $ git branch -a
    $ git checkout -b v_1.16 remotes/origin/branches/stable-1.16
    $ ./auto/configure --prefix=/etc/nginx \
    --sbin-path=/usr/sbin/nginx \
    --conf-path=/etc/nginx/nginx.conf \
    --error-log-path=/var/log/nginx/error.log \
    --http-log-path=/var/log/nginx/access.log \
    --pid-path=/var/run/nginx.pid \
    --lock-path=/var/run/nginx.lock \
    --http-client-body-temp-path=/var/cache/nginx/client_temp \
    --http-proxy-temp-path=/var/cache/nginx/proxy_temp \
    --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
    --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
    --http-scgi-temp-path=/var/cache/nginx/scgi_temp \
    --with-http_realip_module \
    --with-http_addition_module \
    --with-http_sub_module \
    --with-http_dav_module \
    --with-http_flv_module \
    --with-http_mp4_module \
    --with-http_gunzip_module \
    --with-http_gzip_static_module \
    --with-http_random_index_module \
    --with-http_secure_link_module \
    --with-http_stub_status_module \
    --with-http_auth_request_module \
    --with-threads \
    --with-stream \
    --with-http_slice_module \
    --with-mail \
    --with-file-aio \
    --with-http_v2_module \
    --with-http_ssl_module \
    --with-openssl=/opt/openssl \
    --with-mail_ssl_module \
    --with-stream_ssl_module
1
2
$ make 
$ make install