Tuesday, June 16, 2020

How To Build Compile Nginx From Source on Ubuntu 20.04 LTS


------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Nginx is an open source HTTP Web server and reverse proxy server.

Offcial Website -https://www.nginx.com/  | https://www.nginx.com/resources/wiki/

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Ubuntu 20.04 LTS 64BIT                   Hostname - www.yourdomain.com  - ip Address - 192.168.1.20

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

apt install build-essential libpcre3-dev zlib1g-dev libssl-dev libatomic-ops-dev libxml2-dev libxslt1-dev libgeoip1 libgeoip-dev libgd-dev google-perftools libgoogle-perftools-dev libperl-dev net-tools curl git software-properties-common -y


Download Link - http://nginx.org/en/download.html


wget https://nginx.org/download/nginx-1.19.0.tar.gz

tar zxf nginx-1.19.0.tar.gz ; cd nginx-1.19.0

useradd -s /sbin/nologin nginx

./configure --help


./configure --user=nginx --group=nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --with-select_module --with-poll_module --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_xslt_module=dynamic --with-http_image_filter_module --with-http_image_filter_module=dynamic --with-http_geoip_module --with-http_geoip_module=dynamic --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_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module --with-http_perl_module=dynamic --with-mail --with-mail=dynamic --with-mail_ssl_module --with-stream --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-stream_geoip_module --with-stream_geoip_module=dynamic --with-stream_ssl_preread_module --with-google_perftools_module --with-cpp_test_module --with-compat --with-pcre --with-pcre-jit  --with-zlib-asm=CPU --with-libatomic --with-debug --with-ld-opt="-Wl,-E"


make && sudo make install


nano /lib/systemd/system/nginx.service

[Unit]

Description=The Nginx 1.19.0 service

After=syslog.target network.target remote-fs.target nss-lookup.target


[Service]

Type=forking

PIDFile=/usr/local/nginx/logs/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

systemctl daemon-reload ; systemctl start nginx ; systemctl status nginx

nginx -v && sudo nginx -V


http://192.168.1.20

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

nginx configuration prefix: "/etc/nginx"   

nginx configuration file: "/etc/nginx/nginx.conf"

nginx path prefix: "/usr/local/nginx"

WebRoot Dir -  /usr/local/nginx/html/

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment