Nginx 1.14.0 full version compiled from CentOS 7 source code

Keywords: Nginx yum OpenSSL zlib

1, Installation preparation

1. Go to the nginx source package on the official website http://nginx.org/en/download.html ]

2. Loading dependence

yum -y install pcre pcre-devel
yum -y install openssl openssl-devel
yum -y install gcc-c++ autoconf automake
yum install -y zlib-devel
yum -y install libxml2 libxml2-dev
yum -y install libxslt-devel
yum -y install gd-devel
yum -y install perl-devel perl-ExtUtils-Embed
yum -y install GeoIP GeoIP-devel GeoIP-data

3. Build users and user groups

groupadd nginx
useradd -g nginx nginx

4. Extended description

1. Specify the directory of installed third-party modules, such as https support, etc ** --add-module=/usr/local/nginx/extra/modules --add-dynamic-module=/usr/local/nginx/extra/dynamic-modules **

If you don't add these two parameters, you can try again later. / configure and make don't need make install because they will be overwritten [reference article: https://blog.csdn.net/cxm19881208/article/details/64441890 ]

2. google optimization tools: *--with-google_perftools_module * You need to install libunwind. Usually, you don't need to open this item in the development environment. It's a bit cumbersome to install. You need to google or duniang yourself

3. Problem compiling and installing? Reference article: https://tieba.baidu.com/p/4568751779?red_tag=0918228242

2, Build install

1. . / configure (suggest. / configure --help to have a look)

./configure --prefix=/usr/local/nginx \
  --sbin-path=/usr/local/sbin/nginx \
  --modules-path=/usr/local/nginx/modules \
  --conf-path=/usr/local/nginx/etc/nginx.conf \
  --error-log-path=/usr/local/nginx/error.log \
  --pid-path=/usr/local/nginx/run/nginx.pid \
  --lock-path=/usr/local/nginx/lock/nginx.lock \
  --user=nginx \
  --group=nginx \
  --with-select_module \
  --with-poll_module \
  --with-threads \
  --with-file-aio \
  --with-http_ssl_module \
  --with-http_v2_module \
  --with-http_realip_module \
  --with-http_addition_module \
  --with-http_xslt_module \
  --with-http_xslt_module=dynamic \
  --with-http_image_filter_module \
  --with-http_image_filter_module=dynamic \
  --with-http_geoip_module \
  --with-http_geoip_module=dynamic \
  --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_auth_request_module \
  --with-http_random_index_module \
  --with-http_secure_link_module \
  --with-http_degradation_module \
  --with-http_slice_module \
  --with-http_stub_status_module \
  --http-log-path=/usr/local/nginx/access.log \
  --http-client-body-temp-path=/usr/local/nginx/http/client-body \
  --http-proxy-temp-path=/usr/local/nginx/http/proxy \
  --http-fastcgi-temp-path=/usr/local/nginx/http/fastcgi \
  --http-uwsgi-temp-path=/usr/local/nginx/http/uwsgi \
  --http-scgi-temp-path=/usr/local/nginx/http/scgi \
  --with-mail \
  --with-mail=dynamic \
  --with-mail_ssl_module \
  --without-mail_pop3_module \
  --without-mail_imap_module \
  --without-mail_smtp_module \
  --with-stream \
  --with-stream=dynamic \
  --with-stream_ssl_module \
  --with-stream_realip_module \
  --with-stream_geoip_module \
  --with-stream_geoip_module=dynamic \
  --with-stream_ssl_preread_module \
  --with-cpp_test_module \
  --with-compat \
  --with-debug

2. The following information indicates that the compilation is successful

Configuration summary
  + using threads
  + using system PCRE library
  + using system OpenSSL library
  + using system zlib library

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/sbin"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/usr/local/nginx/etc"
  nginx configuration file: "/usr/local/nginx/etc/nginx.conf"
  nginx pid file: "/usr/local/nginx/run"
  nginx error log file: "/usr/local/nginx/logs"
  nginx http access log file: "/usr/local/nginx/http/log"
  nginx http client request body temporary files: "/usr/local/nginx/http/client-body-temp-path"
  nginx http proxy temporary files: "/usr/local/nginx/http/proxy-temp-path"
  nginx http fastcgi temporary files: "/usr/local/nginx/http/fastcgi-temp-path"
  nginx http uwsgi temporary files: "/usr/local/nginx/http/uwsgi-temp-path"
  nginx http scgi temporary files: "/usr/local/nginx/http/scgi-temp-path"

3. Build install

make &make install

4. See the following output information installation completed

make[1]: Leaving directory `/usr/local/src/nginx-1.14.0'
[1]+  Done                    make

5. Since the path of sbin has been made during. / configure, do not manually enter sbin again. If which nginx cannot be found, please join Ln-S soft chain by yourself

6. Test and find the location of nginx's configuration file

nginx -t

7. Check

id nginx

8. Specify profile

nginx -c /usr/local/nginx/etc/nginx.conf

9. Smooth restart

nginx -s reload

10. There may be no directory for error reporting. Just create one according to the prompt. configure the client-body of http when configuring

mkdir -p /usr/local/nginx/http/client-body
nginx -s reload

Posted by egturnkey on Thu, 02 Jan 2020 05:30:49 -0800