Skip to content

Instantly share code, notes, and snippets.

@kwypchlo
Last active March 31, 2020 10:01
Show Gist options
  • Save kwypchlo/07421c96ec2efa2eb60e80e7df87ecbe to your computer and use it in GitHub Desktop.
Save kwypchlo/07421c96ec2efa2eb60e80e7df87ecbe to your computer and use it in GitHub Desktop.
nginx

https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#sources

install dependencies

PCRE

wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
tar -zxf pcre-8.44.tar.gz
rm pcre-8.44.tar.gz
cd pcre-8.44
./configure
make
sudo make install
cd ..

zlib

wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxf zlib-1.2.11.tar.gz
rm zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
sudo make install
cd ..

OpenSSL

wget http://www.openssl.org/source/openssl-1.1.1c.tar.gz
tar -zxf openssl-1.1.1c.tar.gz
rm openssl-1.1.1c.tar.gz
cd openssl-1.1.1c
./Configure linux-x86_64 --prefix=/usr
make
sudo make install
cd ..

Install nginx

wget https://nginx.org/download/nginx-1.17.9.tar.gz
tar zxf nginx-1.17.9.tar.gz
rm nginx-1.17.9.tar.gz
cd nginx-1.17.9
./configure --prefix=/usr/local/nginx --user=www-data --with-pcre=../pcre-8.44 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.1.1c --with-http_ssl_module --with-stream --with-mail=dynamic --with-http_stub_status_module --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_sub_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail_ssl_module
make
sudo make install
# /lib/systemd/system/nginx.service
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/sbin/nginx/nginx -t
ExecStart=/usr/local/sbin/nginx/nginx
ExecReload=/usr/local/sbin/nginx/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment