Skip to main content

Build Nginx

Custom build Nginx

You can build any custom version of nginx using the command line tool nginxctl. An example is given below :

Command:

nginxctl nginxbuild

Command Options:

nginxctl nginxbuild [option1=value1] [option2] ..
                    --version=Version       - Choose your nginx version
                    --enable-pagespeed      - To build the page speed module with nginx
                    --enable-modsec         - To build mod_security 

Example Commands

1) Install Nginx version 1.28.0 :

nginxctl nginxbuild --version=1.28.0

2) Install nginx with mod security:

nginxctl nginxbuild --enable-modsec

Adding Custom Build Flags or External Modules

The Cpnginx uses the default build configure settings from  /etc/cpnginx/build/configure.sh  . You may create a custom build configure script as follows:

cp -v /etc/cpnginx/build/configure.sh /etc/cpnginx/build/custom/configure.sh

Now edit the custom configure script /etc/cpnginx/build/custom/configure.sh and add the build flags. An example is given below,

--with-http_mp4_module
--with-http_flv_module
--with-my-custom-module=/usr/src/my-custom-module