Compiled Home Pages




Click here to list/download the source code.

Instructions to compile Nginx with CHP

  1. Browse to http://nginx.org/download/
  2. Look at all the download files. Try to find the one with the newest date.
  3. Write down the name of the download. For example nginx-1.25.4.tar.gz
  4. Create and CD into the directory you want to create the NGINX at.
  5. Run wget http://nginx.org/download/nginx-1.21.0.tar.gz, but change the numbers to the numbers from step 3.
  6. Run tar -zxvf nginx-1.21.0.tar.gz, but change the numbers to the numbers from step 3.
  7. Install build tools: sudo apt-get install build-essential
  8. CD into the directory by running cd nginx-1.21.0. But change the numbers to the numbers from step 3.
  9. Download the nginx-chp-module folder. Put it in the src folder.
  10. Install the PCRE library with
    sudo apt install libpcre3 libpcre3-dev
  11. Install libssl-dev with
    sudo apt install libssl-dev
  12. Run the command pwd
  13. 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
    	
  14. Edit runconfigure.sh. Change the line at the bottom to have the right path for the nginx-chp-module from step 12.
  15. Run chmod 777 runconfigure.sh
  16. Run ./runconfigure.sh
  17. Compile to binaries by run the command called
    make
  18. Install NGINX by running the command
    sudo make install
  19. Create /var/cache/nginx:
    sudo mkdir /var/cache/nginx
    sudo chown nginx /var/cache/nginx
    sudo chgrp nginx /var/cache/nginx
  20. 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
    	
  21. Run
    sudo systemctl enable nginx.service
    sudo systemctl start nginx.service
  22. To see if it's running, run
    ps -e|grep nginx
    To test, browse to http://127.0.0.1
  23. CHP requires libwebsockets. Download the latest version by running this command:
    git clone https://libwebsockets.org/repo/libwebsockets
  24. 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
  25. CHP also requires the Mariadb C API. To install it, run this:
    sudo apt install libmariadb3 libmariadb-dev