Skip to content

Instantly share code, notes, and snippets.

@onlinejudge95
Last active September 20, 2021 11:29
Show Gist options
  • Save onlinejudge95/f4ff6a1eed3e0a0c517367a5a2f49ce3 to your computer and use it in GitHub Desktop.
Save onlinejudge95/f4ff6a1eed3e0a0c517367a5a2f49ce3 to your computer and use it in GitHub Desktop.
Installing NGINX from source
#!/bin/bash
apt update
apt upgrade --assume-yes
apt autoremove
apt install --assume-yes build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev
wget install https://nginx.org/download/nginx-1.21.1.tar.gz
tar -xvzf nginx-1.21.1.tar.gz
rm nginx-1.21.1.tar.gz
cd nginx-1.21.1
./configure \
--with-http_ssl_module \
--with-http_v2_module \
--with-pcre \
--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 \
--sbin-path=/usr/bin/nginx
make
make install
nginx -V
touch /lib/systemd/system/nginx.service
echo "[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=/var/run/nginx.pid
ExecStartPre=/usr/bin/nginx -t
ExecStart=/usr/bin/nginx
ExecReload=/usr/bin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target" > /lib/systemd/system/nginx.service
systemctl start nginx
systemctl status nginx
systemctl enable nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment