0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Build memo for nginx open source from source with specific modules

Last updated at Posted at 2024-05-22

Build memo for nginx open source from source with specific modules

System

# cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04 LTS (Noble Numbat)"
(snip)

Refs

  • Compiling and Installing from Source

Check dependencies

# apt list --installed | grep -i pcre2*dev
# apt list --installed | grep -i ^zlib1g-dev
# apt list --installed | grep -i ^libssl-dev
# apt-cache search . | grep -Ei pcre2.*dev.*
libpcre2-dev - New Perl Compatible Regular Expression Library - development files
libpcre2-ocaml-dev - OCaml bindings for PCRE2 (Perl Compatible Regular Expression)
librust-grep-pcre2-dev - Use PCRE2 with the 'grep' crate - Rust source code
librust-pcre2-dev - High level wrapper library for PCRE2 - Rust source code
librust-pcre2-sys-dev - Low level bindings to PCRE2 - Rust source code
lua-rex-pcre2-dev - PCRE2 development files for the Lua language

Install depemdencies lacked

# apt -y install libpcre2-dev
# apt -y install zlib1g-dev
# apt -y install libssl-dev

Check stable version namber

Download source

# wget https://nginx.org/download/nginx-1.26.0.tar.gz
# tar zxf nginx-1.26.0.tar.gz

Simple build test

# cd nginx-1.26.0/
~/nginx-1.26.0# ./configure

(snip)
Configuration summary
  + using system PCRE2 library
  + OpenSSL library is not used
  + using system zlib library

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"
  nginx http access log file: "/usr/local/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp
~/nginx-1.26.0#
~/nginx-1.26.0# make
~/nginx-1.26.0# make install

If no problems, clean

~/nginx-1.26.0# make clean
rm -rf Makefile objs

Build with several options

~/nginx-1.26.0# ./configure --with-stream --with-http_ssl_module

(snip)
Configuration summary
  + using system PCRE2 library
  + using system OpenSSL library
  + using system zlib library

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"
  nginx http access log file: "/usr/local/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"
   206          /* check weather a cookie is present or not and save it */
   207          /* if (ngx_http_parse_multi_header_lines(&r->headers_in.cookies, &iphp->sticky_conf->cookie_name, &route) != NGX_DECLINED) { */
   208          if (ngx_http_parse_multi_header_lines(r, r->headers_in.cookie, &iphp->sticky_conf->cookie_name, &route) != NULL) {
~/nginx-1.26.0# ./configure --with-stream --with-http_ssl_module --add-module=/root/nginx-goodies-nginx-sticky-module-ng-08a395c66e42

(snip)
adding module in /root/nginx-goodies-nginx-sticky-module-ng-08a395c66e42
 + ngx_http_sticky_module was configured
checking for PCRE2 library ... found
checking for OpenSSL library ... found
checking for zlib library ... found
creating objs/Makefile

Configuration summary
  + using system PCRE2 library
  + using system OpenSSL library
  + using system zlib library

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"
  nginx http access log file: "/usr/local/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"
  • Other configuration trials...
./configure \
--with-stream \
--with-http_ssl_module \
--add-module=/root/nginx-goodies-nginx-sticky-module-ng-08a395c66e42 \
--conf-path=/etc/nginx/nginx.conf
# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.26.0
built by gcc 13.2.0 (Ubuntu 13.2.0-23ubuntu4)
built with OpenSSL 3.0.13 30 Jan 2024
TLS SNI support enabled
configure arguments: --with-stream --with-http_ssl_module --add-module=/root/nginx-goodies-nginx-sticky-module-ng-08a395c66e42 --conf-path=/etc/nginx/nginx.conf

After installation

stop start etc

# /usr/local/nginx/sbin/nginx -s quit
# /usr/local/nginx/sbin/nginx -s reload

verify

# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?