Install Nginx from source

Install Requirements

CentOS/RHEL/Fedora

yum install glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel

Ubuntu/Debian

apt-get install libpcre3-dev

Create nginx user

useradd -c "Nginx user" -s /bin/false -r -d /var/lib/nginx nginx

Downoad and insta Nginx

You can download latest version of Nginx source code from

https://nginx.org/en/download.html

To install version 1.19.2, run

cd /usr/local/src
wget https://nginx.org/download/nginx-1.19.2.tar.gz
tar xvf nginx-1.19.2.tar.gz
cd nginx-1.19.2
./configure --user=nginx --group=nginx --prefix=/usr/share --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/log/run/nginx.pid --lock-path=/var/log/lock/subsys/nginx --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_gzip_static_module --with-http_stub_status_module --with-http_mp4_module --with-http_secure_link_module --with-http_v2_module
make
make install

Test Nginx

To start nginx run

/usr/sbin/nginx

Configuration file is at

/etc/nginx/nginx.conf

See Nginx

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *