Skip to content

Instantly share code, notes, and snippets.

@judge2020
Last active October 29, 2018 17:40
Show Gist options
  • Select an option

  • Save judge2020/e3461e06c065830d1359adca1be90893 to your computer and use it in GitHub Desktop.

Select an option

Save judge2020/e3461e06c065830d1359adca1be90893 to your computer and use it in GitHub Desktop.

Revisions

  1. judge2020 revised this gist Mar 23, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    To build nginx, run in terminal
    ```
    wget https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/3e33fd924382a020934f260780dff3d0d91bc04d/build_nginx.sh && source build_nginx.sh
    wget https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/b77d7cd58606002b12392fc066fe1cdda5c0cd30/build_nginx.sh && source build_nginx.sh
    ```
  2. judge2020 revised this gist Mar 23, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion build_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -99,7 +99,7 @@ cd nginx-1.*
    EOF
    sh configure.sh
    cd nginx-*
    sudo tee -a /etc/systemd/system/nginx.service << EOF
    [ -f /etc/systemd/system/nginx.service ] || sudo tee -a /etc/systemd/system/nginx.service << EOF
    [Unit]
    Description=A high performance web server and a reverse proxy server
    After=network.target
  3. judge2020 revised this gist Mar 23, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    To build nginx, run in terminal
    ```
    wget https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/0e838667c8f665de1e274b843bad84411842c6e1/build_nginx.sh && source build_nginx.sh
    wget https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/3e33fd924382a020934f260780dff3d0d91bc04d/build_nginx.sh && source build_nginx.sh
    ```
  4. judge2020 revised this gist Mar 23, 2018. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions build_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -99,4 +99,22 @@ cd nginx-1.*
    EOF
    sh configure.sh
    cd nginx-*
    sudo tee -a /etc/systemd/system/nginx.service << EOF
    [Unit]
    Description=A high performance web server and a reverse proxy server
    After=network.target
    [Service]
    Type=forking
    PIDFile=/run/nginx.pid
    ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
    ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
    ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
    ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid
    TimeoutStopSec=5
    KillMode=mixed
    [Install]
    WantedBy=multi-user.target
    EOF
    echo If everything went as planned, you should be able to "make" then "make Install".
  5. judge2020 revised this gist Mar 23, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    To build nginx, run in terminal
    ```
    wget https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/76d1cbbcd73467d9346c3ba78c2b4d8795babe9f/build_nginx.sh && sh build_nginx.sh
    wget https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/0e838667c8f665de1e274b843bad84411842c6e1/build_nginx.sh && source build_nginx.sh
    ```
  6. judge2020 revised this gist Mar 18, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    To build nginx, run in terminal
    ```
    https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/76d1cbbcd73467d9346c3ba78c2b4d8795babe9f/build_nginx.sh && sh build_nginx.sh
    wget https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/76d1cbbcd73467d9346c3ba78c2b4d8795babe9f/build_nginx.sh && sh build_nginx.sh
    ```
  7. judge2020 revised this gist Mar 18, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    To build nginx, run in terminal
    ```
    wget https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/07a15b9238aa5d1384d1e5a74c92e4747047c112/build_nginx.sh && sh build_nginx.sh
    https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/76d1cbbcd73467d9346c3ba78c2b4d8795babe9f/build_nginx.sh && sh build_nginx.sh
    ```
  8. judge2020 revised this gist Mar 17, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions build_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@ find . -maxdepth 1 -mindepth 1 -type d -exec echo mv "{}" "{}-$RANDOM" \;
    cd ~/nginx
    mv nginx-* _nginx
    sudo apt install -y wget build-essential python3 python3-requests
    sudo mkdir -p /var/lib/nginx/body
    python3 -m pip install requests
    cat << EOF > dlnginx.py
    # Hopefilly this works for a while. As long as their CHANGES file doesnt change
  9. judge2020 revised this gist Mar 17, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    To build nginx, run in terminal
    ```
    wget https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/dd1f741ad6dd17529433914591703478f2634ac5/build_nginx.sh && sh build_nginx.sh
    wget https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/07a15b9238aa5d1384d1e5a74c92e4747047c112/build_nginx.sh && sh build_nginx.sh
    ```
  10. judge2020 revised this gist Mar 17, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    To build nginx, run in terminal
    ```
    source <(curl -sH 'Cache-Control: no-cache' https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/dd1f741ad6dd17529433914591703478f2634ac5/build_nginx.sh)
    wget https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/dd1f741ad6dd17529433914591703478f2634ac5/build_nginx.sh && sh build_nginx.sh
    ```
  11. judge2020 revised this gist Mar 17, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion build_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ cd ~/nginx/_nginx
    find . -maxdepth 1 -mindepth 1 -type d -exec echo mv "{}" "{}-$RANDOM" \;
    cd ~/nginx
    mv nginx-* _nginx
    sudo apt install -y wget build-essential python3 python3-pip
    sudo apt install -y wget build-essential python3 python3-requests
    python3 -m pip install requests
    cat << EOF > dlnginx.py
    # Hopefilly this works for a while. As long as their CHANGES file doesnt change
  12. judge2020 revised this gist Mar 17, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    To build nginx, run in terminal
    ```
    source <(curl -sH 'Cache-Control: no-cache' https://gist.githubusercontent.com/judge2020/e3461e06c065830d1359adca1be90893/raw/build_nginx.sh)
    source <(curl -sH 'Cache-Control: no-cache' https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/dd1f741ad6dd17529433914591703478f2634ac5/build_nginx.sh)
    ```
  13. judge2020 revised this gist Mar 17, 2018. 1 changed file with 26 additions and 15 deletions.
    41 changes: 26 additions & 15 deletions build_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,11 @@
    mkdir -p ~/nginx
    mkdir -p ~/nginx/_nginx
    cd ~/nginx/_nginx
    find . -maxdepth 1 -mindepth 1 -type d -exec echo mv "{}" "{}-$RANDOM" \;
    cd ~/nginx
    mv nginx-* _nginx
    sudo apt install build-essential python3
    python -m pip install requests
    sudo apt install -y wget build-essential python3 python3-pip
    python3 -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
    @@ -12,24 +14,32 @@ 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(' ')
    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)
    # for chunk in r.iter_content():
    # f.write(chunk)
    EOF
    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
    if [ ! -f pcre-8.40/NEWS ]; then
    wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz && tar xzvf pcre-8.40.tar.gz
    fi
    zlib-1.2.11/FAQ
    if [ ! -f zlib-1.2.11/FAQ ]; then
    wget http://www.zlib.net/zlib-1.2.11.tar.gz && tar xzvf zlib-1.2.11.tar.gz
    fi
    if [ ! -f openssl-1.1.0g/FAQ ]; then
    wget https://www.openssl.org/source/openssl-1.1.0g.tar.gz && tar xzvf openssl-1.1.0g.tar.gz
    fi
    git clone https://github.com/arut/nginx-rtmp-module
    rm -rf *.tar.gz
    cat << EOF > configure.sh
    #!/bin/bash
    @@ -50,7 +60,7 @@ cd nginx-1.*
    --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=../openssl-1.1.0g \
    --with-openssl-opt=enable-ec_nistp_64_gcc_128 \
    --with-openssl-opt=no-nextprotoneg \
    --with-openssl-opt=no-weak-ssl-ciphers \
    @@ -83,8 +93,9 @@ cd nginx-1.*
    --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'
    --with-ld-opt='-Wno-error=date-time -Wl,-Bsymbolic-functions -Wl,-z,now' \
    --add-module=../nginx-rtmp-module
    EOF
    sh configure.sh
    cd nginx-*
    echo If everything went as planned, you should be able to "make" then "make Install".
    echo If everything went as planned, you should be able to "make" then "make Install".
  14. judge2020 revised this gist Feb 28, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions build_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,7 @@ mkdir -p ~/nginx
    mkdir -p ~/nginx/_nginx
    cd ~/nginx
    mv nginx-* _nginx
    sudo apt install build-essential python3
    python -m pip install requests
    cat << EOF > dlnginx.py
    # Hopefilly this works for a while. As long as their CHANGES file doesnt change
    @@ -25,8 +26,7 @@ os.system('tar -xvf ' + file)
    # for chunk in r.iter_content():
    # f.write(chunk)
    EOF
    python dlnginx.py
    [[ -d nginx-* ]] || python3 dlnginx.py
    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
  15. judge2020 revised this gist Feb 28, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    To build nginx, run in terminal
    ```
    source <(curl -s https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/build_nginx.sh)
    source <(curl -sH 'Cache-Control: no-cache' https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/build_nginx.sh)
    ```
  16. judge2020 revised this gist Feb 28, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion build_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -25,7 +25,8 @@ os.system('tar -xvf ' + file)
    # for chunk in r.iter_content():
    # f.write(chunk)
    EOF
    python dlnginx.py || python3 dlnginx.py
    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
  17. judge2020 revised this gist Feb 28, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion build_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -25,7 +25,7 @@ os.system('tar -xvf ' + file)
    # for chunk in r.iter_content():
    # f.write(chunk)
    EOF
    python dlnginx.py
    python dlnginx.py || 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
  18. judge2020 revised this gist Feb 28, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    To build nginx, run in terminal
    ```
    source <(curl -s https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/build_nginx.sh)
    source <(curl -s https://gist.githubusercontent.com/judge2020/e3461e06c065830d1359adca1be90893/raw/build_nginx.sh)
    ```
  19. judge2020 revised this gist Feb 28, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    To build nginx, run in terminal
    ```
    source <(curl -s https://gist.github.com/judge2020/[gist_id]/raw/build_nginx.sh)
    source <(curl -s https://gist.github.com/judge2020/e3461e06c065830d1359adca1be90893/raw/build_nginx.sh)
    ```
  20. judge2020 created this gist Feb 28, 2018.
    4 changes: 4 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    To build nginx, run in terminal
    ```
    source <(curl -s https://gist.github.com/judge2020/[gist_id]/raw/build_nginx.sh)
    ```
    89 changes: 89 additions & 0 deletions build_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,89 @@
    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
    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".