Click
here to list/download the source code.
Instructions to compile Nginx with CHP
- Browse to http://nginx.org/download/
- Look at all the download files. Try to find the one with the newest date.
- Write down the name of the download. For example nginx-1.25.4.tar.gz
- Create and CD into the directory you want to create the NGINX at.
- Run wget http://nginx.org/download/nginx-1.21.0.tar.gz, but change the numbers to the numbers from step 3.
- Run tar -zxvf nginx-1.21.0.tar.gz, but change the numbers to the numbers from step 3.
- Install build tools: sudo apt-get install build-essential
- CD into the directory by running cd nginx-1.21.0. But change the numbers to the numbers from step 3.
- Download the nginx-chp-module folder. Put it in the src folder.
- Install the PCRE library with
sudo apt install libpcre3 libpcre3-dev
- Install libssl-dev with
sudo apt install libssl-dev
- Run the command pwd
- Create the runconfigure.sh script using the following:
./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 \
--user=www-data \
--group=www-data \
--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-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-http_v2_module \
--with-threads \
--with-stream \
--with-stream_ssl_module \
--with-http_slice_module \
--add-module=/home/pi5/Downloads/nginx-1.25.4/src/nginx-chp-module
- Edit runconfigure.sh. Change the line at the bottom to have the right path for the nginx-chp-module from step 12.
- Run chmod 777 runconfigure.sh
- Run ./runconfigure.sh
- Compile to binaries by run the command called
make
- Install NGINX by running the command
sudo make install
- Create /var/cache/nginx:
sudo mkdir /var/cache/nginx
sudo chown nginx /var/cache/nginx
sudo chgrp nginx /var/cache/nginx
- Save this file as /lib/systemd/system/nginx.service
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
- Run
sudo systemctl enable nginx.service
sudo systemctl start nginx.service
- To see if it's running, run
ps -e|grep nginx
To test, browse to http://127.0.0.1
- CHP requires libwebsockets. Download the latest version by running this command:
git clone https://libwebsockets.org/repo/libwebsockets
- To compile it, run
cd libwebsockets
mkdir build
cd build
cmake ..
If cmake doesn't work, install it with sudo apt install cmake
make
sudo make install
- CHP also requires the Mariadb C API. To install it, run this:
sudo apt install libmariadb3 libmariadb-dev