Installation (from source)

Prepare for Options to pass to configure

./configure  --help  

–prefix= for specifing the directory which we want to install nginx.

modules

  • some module default enable,要option out: --without-http_

  • some module default disable,要option in: --with-http_

--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 --user=nginx --group=nginx --with-http_ssl_module --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-stream_ssl_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_spdy_module --with-cc-opt='-O2 -g' $ make $ make install

Perl

--with-http_perl_module --with-http_perl_module=dynamicenables building the embedded Perl modulearrow-up-right. This module is not built by default. --with-perl_modules_path=pathdefines a directory that will keep Perl modules.--with-perl=pathsets the name of the Perl binary.

安裝工具 path : nginx-1.16.1/ 目標安裝 path : nginx-test/

# create directory for target nginx
mkdir nginx-test
# untar gzip and cd to that folder
tar zxvf nginx-1.16.1.tar.gz ; cd nginx-1.16.1

./configure --prefix=/.../nginx-test \
--conf-path=/.../nginx-test/conf/nginx.conf \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_xslt_module \
--with-http_xslt_module=dynamic \

--with-http_perl_module \
--with-http_perl_module=dynamic \
--with-perl_modules_path={path} \
--with-perl={path} \

Install the configured:

Start the service:

Stop the service

To view the current version of nginx, do the following:

To debug issues, view the error.log and access.log files located under /usr/local/nginx/logs

Main Reference

Other Reference

Last updated