To build nginx, run in terminal
source <(curl -sH 'Cache-Control: no-cache' https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/build_nginx.sh)
| mkdir -p ~/nginx | |
| mkdir -p ~/nginx/_nginx | |
| cd ~/nginx | |
| mv nginx-* _nginx | |
| python -m pip install requests | |
| cat << EOF > dlnginx.py | |
| # Hopefilly this works for a while. As long as their CHANGES file doesnt change | |
| from __future__ import print_function | |
| import requests, os | |
| f = requests.get('http://nginx.org/en/CHANGES') | |
| a = f.text.split('Changes with nginx ') | |
| i = 0 | |
| for ab in a: | |
| i += 1 | |
| if i >= 3: | |
| continue | |
| if '1.' in ab: | |
| version = ab[:7].strip(' ') | |
| print(version) | |
| file = 'nginx-' + version + '.tar.gz' | |
| os.system('wget ' + r'http://nginx.org/download/' + file) | |
| os.system('tar -xvf ' + file) | |
| #r = requests.get(r'http://nginx.org/download/' + file, stream=True) | |
| #with open(file, 'wb') as f: | |
| # for chunk in r.iter_content(): | |
| # f.write(chunk) | |
| EOF | |
| python dlnginx.py | |
| [[ -d nginx-* ]] || python3 dlnginx.py | |
| wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz && tar xzvf pcre-8.40.tar.gz | |
| wget http://www.zlib.net/zlib-1.2.11.tar.gz && tar xzvf zlib-1.2.11.tar.gz | |
| wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz && tar xzvf openssl-1.1.0f.tar.gz | |
| rm -rf *.tar.gz | |
| cat << EOF > configure.sh | |
| #!/bin/bash | |
| cd nginx-1.* | |
| ./configure --prefix=/usr/share/nginx \ | |
| --sbin-path=/usr/sbin/nginx \ | |
| --modules-path=/usr/lib/nginx/modules \ | |
| --conf-path=/etc/nginx/nginx.conf \ | |
| --error-log-path=/var/log/nginx/error.log \ | |
| --http-log-path=/var/log/nginx/access.log \ | |
| --pid-path=/run/nginx.pid \ | |
| --lock-path=/var/lock/nginx.lock \ | |
| --user=www-data \ | |
| --group=www-data \ | |
| --build=Ubuntu \ | |
| --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-openssl=../openssl-1.1.0f \ | |
| --with-openssl-opt=enable-ec_nistp_64_gcc_128 \ | |
| --with-openssl-opt=no-nextprotoneg \ | |
| --with-openssl-opt=no-weak-ssl-ciphers \ | |
| --with-openssl-opt=no-ssl3 \ | |
| --with-pcre=../pcre-8.40 \ | |
| --with-pcre-jit \ | |
| --with-zlib=../zlib-1.2.11 \ | |
| --with-compat \ | |
| --with-file-aio \ | |
| --with-threads \ | |
| --with-http_addition_module \ | |
| --with-http_auth_request_module \ | |
| --with-http_dav_module \ | |
| --with-http_flv_module \ | |
| --with-http_gunzip_module \ | |
| --with-http_gzip_static_module \ | |
| --with-http_mp4_module \ | |
| --with-http_random_index_module \ | |
| --with-http_realip_module \ | |
| --with-http_slice_module \ | |
| --with-http_ssl_module \ | |
| --with-http_sub_module \ | |
| --with-http_stub_status_module \ | |
| --with-http_v2_module \ | |
| --with-http_secure_link_module \ | |
| --with-mail \ | |
| --with-mail_ssl_module \ | |
| --with-stream \ | |
| --with-stream_realip_module \ | |
| --with-stream_ssl_module \ | |
| --with-stream_ssl_preread_module \ | |
| --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wno-error=date-time' \ | |
| --with-ld-opt='-Wno-error=date-time -Wl,-Bsymbolic-functions -Wl,-z,now' | |
| EOF | |
| sh configure.sh | |
| cd nginx-* | |
| echo If everything went as planned, you should be able to "make" then "make Install". |