Skip to content

Instantly share code, notes, and snippets.

@vmlive
Last active April 14, 2018 06:48
Show Gist options
  • Select an option

  • Save vmlive/9993932 to your computer and use it in GitHub Desktop.

Select an option

Save vmlive/9993932 to your computer and use it in GitHub Desktop.

Revisions

  1. vmlive revised this gist Apr 11, 2014. 1 changed file with 15 additions and 2 deletions.
    17 changes: 15 additions & 2 deletions install_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -32,8 +32,21 @@ useradd nginx
    groupadd nginx

    cd /usr/local/src
    curl -o /usr/local/src/ngx_cache_purge-2.1.tar.gz http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz
    curl -o /usr/local/src/nginx-1.4.7.tar.gz http://nginx.org/download/nginx-1.4.7.tar.gz

    if [ -s ngx_cache_purge-2.1.tar.gz ]; then
    echo "ngx_cache_purge-2.1.tar.gz [found]"
    else
    echo "Error: ngx_cache_purge-2.1.tar.gz not found!!!download now......"
    wget -c http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz
    fi

    if [ -s nginx-1.4.7.tar.gz ]; then
    echo "nginx-1.4.7.tar.gz [found]"
    else
    echo "Error: nginx-1.4.7.tar.gz not found!!!download now......"
    wget -c http://nginx.org/download/nginx-1.4.7.tar.gz
    fi

    tar zxvf ngx_cache_purge-2.1.tar.gz
    tar zxvf nginx-1.4.7.tar.gz
    cd nginx-1.4.7
  2. vmlive revised this gist Apr 10, 2014. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions install_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -21,6 +21,10 @@ if [ "$(id -u)" != "0" ]; then
    exit 1
    fi

    #add the third-party repo
    rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

    #install packges
    for packages in patch make cmake gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal nano fonts-chinese gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap libxslt-devel pcre pcre-devel gd-devel GeoIP-devel;
    do yum -y install $packages; done

    @@ -77,8 +81,10 @@ chmod 755 /etc/init.d/nginx
    mkdir -p /etc/nginx/conf.d

    # rm -rf /etc/nginx/nginx.conf

    # for cache
    curl -o /etc/nginx/nginx.conf https://gist.github.com/vmlive/10001382/raw

    # for mirror
    # curl -o /etc/nginx/nginx.conf https://gist.github.com/vmlive/10022016/raw
    mkdir -p /var/log/nginx
  3. vmlive revised this gist Apr 7, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -80,7 +80,7 @@ mkdir -p /etc/nginx/conf.d
    # for cache
    curl -o /etc/nginx/nginx.conf https://gist.github.com/vmlive/10001382/raw
    # for mirror
    # curl -o /etc/nginx/nginx.conf https://gist.github.com/vmlive/35d08c52740fa176975f/raw
    # curl -o /etc/nginx/nginx.conf https://gist.github.com/vmlive/10022016/raw
    mkdir -p /var/log/nginx
    chown nginx:root /var/log/nginx
    mkdir -p /var/lib/nginx
  4. vmlive revised this gist Apr 6, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion install_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -77,8 +77,10 @@ chmod 755 /etc/init.d/nginx
    mkdir -p /etc/nginx/conf.d

    # rm -rf /etc/nginx/nginx.conf
    # for cache
    curl -o /etc/nginx/nginx.conf https://gist.github.com/vmlive/10001382/raw

    # for mirror
    # curl -o /etc/nginx/nginx.conf https://gist.github.com/vmlive/35d08c52740fa176975f/raw
    mkdir -p /var/log/nginx
    chown nginx:root /var/log/nginx
    mkdir -p /var/lib/nginx
  5. vmlive revised this gist Apr 6, 2014. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions install_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -76,6 +76,9 @@ chmod 755 /etc/init.d/nginx
    # mkdir -p /etc/nginx/sites-enabled
    mkdir -p /etc/nginx/conf.d

    # rm -rf /etc/nginx/nginx.conf
    curl -o /etc/nginx/nginx.conf https://gist.github.com/vmlive/10001382/raw

    mkdir -p /var/log/nginx
    chown nginx:root /var/log/nginx
    mkdir -p /var/lib/nginx
  6. vmlive revised this gist Apr 5, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion install_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -77,4 +77,6 @@ chmod 755 /etc/init.d/nginx
    mkdir -p /etc/nginx/conf.d

    mkdir -p /var/log/nginx
    chown nginx:root /var/log/nginx
    chown nginx:root /var/log/nginx
    mkdir -p /var/lib/nginx
    chown nginx:root /var/lib/nginx
  7. vmlive revised this gist Apr 5, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -63,7 +63,7 @@ cd nginx-1.4.7
    --with-sha1=/usr/include/openssl \
    --with-md5=/usr/include/openssl \
    --with-mail \
    --with-mail_ssl_module
    --with-mail_ssl_module \
    --add-module=/usr/local/src/ngx_cache_purge-2.1

    make
  8. vmlive revised this gist Apr 5, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion install_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,8 @@ if [ "$(id -u)" != "0" ]; then
    exit 1
    fi

    yum install -y pcre pcre-devel zlib zlib-devel openssl openssl-devel libxml2-devel libxslt-devel gd-devel GeoIP-devel
    for packages in patch make cmake gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal nano fonts-chinese gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap libxslt-devel pcre pcre-devel gd-devel GeoIP-devel;
    do yum -y install $packages; done

    useradd nginx
    groupadd nginx
  9. vmlive revised this gist Apr 5, 2014. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions install_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -28,10 +28,10 @@ groupadd nginx

    cd /usr/local/src
    curl -o /usr/local/src/ngx_cache_purge-2.1.tar.gz http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz
    curl -o /usr/local/src/nginx-1.4.2.tar.gz http://nginx.org/download/nginx-1.4.2.tar.gz
    curl -o /usr/local/src/nginx-1.4.7.tar.gz http://nginx.org/download/nginx-1.4.7.tar.gz
    tar zxvf ngx_cache_purge-2.1.tar.gz
    tar zxvf nginx-1.4.2.tar.gz
    cd nginx-1.4.2
    tar zxvf nginx-1.4.7.tar.gz
    cd nginx-1.4.7
    ./configure --prefix=/etc/nginx \
    --user=nginx \
    --group=nginx \
  10. vmlive revised this gist Apr 5, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -68,7 +68,7 @@ cd nginx-1.4.2
    make
    make install

    curl -o /etc/init.d/nginx https://gist.github.com/pacojp/5720689/raw/
    curl -o /etc/init.d/nginx https://gist.githubusercontent.com/vmlive/9994257/raw
    chmod 755 /etc/init.d/nginx

    # mkdir -p /etc/nginx/sites-available
  11. vmlive revised this gist Apr 5, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ echo "========================================================================="

    #
    # # sample usage
    # curl -o /tmp/install_nginx.sh https://gist.github.com/pacojp/5704628/raw
    # curl -o /tmp/install_nginx.sh https://gist.githubusercontent.com/vmlive/9993932/raw
    # nohup /bin/bash /tmp/install_nginx.sh > /tmp/install_nginx.sh.log && rm -f /tmp/install_nginx.sh &
    #

  12. vmlive revised this gist Apr 5, 2014. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions install_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,14 @@
    #!/bin/bash

    clear
    echo "========================================================================="
    echo "Nginx script V1.0 for CentOS/RadHat Linux Written by llama"
    echo "========================================================================="
    echo "A tool to auto-compile & install Nginx on Linux "
    echo ""
    echo "For more information please contact llama"
    echo "========================================================================="

    #
    # # sample usage
    # curl -o /tmp/install_nginx.sh https://gist.github.com/pacojp/5704628/raw
    @@ -18,7 +27,9 @@ useradd nginx
    groupadd nginx

    cd /usr/local/src
    curl -o /usr/local/src/ngx_cache_purge-2.1.tar.gz http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz
    curl -o /usr/local/src/nginx-1.4.2.tar.gz http://nginx.org/download/nginx-1.4.2.tar.gz
    tar zxvf ngx_cache_purge-2.1.tar.gz
    tar zxvf nginx-1.4.2.tar.gz
    cd nginx-1.4.2
    ./configure --prefix=/etc/nginx \
    @@ -52,6 +63,7 @@ cd nginx-1.4.2
    --with-md5=/usr/include/openssl \
    --with-mail \
    --with-mail_ssl_module
    --add-module=/usr/local/src/ngx_cache_purge-2.1

    make
    make install
  13. vmlive created this gist Apr 5, 2014.
    67 changes: 67 additions & 0 deletions install_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,67 @@
    #!/bin/bash

    #
    # # sample usage
    # curl -o /tmp/install_nginx.sh https://gist.github.com/pacojp/5704628/raw
    # nohup /bin/bash /tmp/install_nginx.sh > /tmp/install_nginx.sh.log && rm -f /tmp/install_nginx.sh &
    #

    # Make sure only root can run our script
    if [ "$(id -u)" != "0" ]; then
    echo "This script must be run as root" 1>&2
    exit 1
    fi

    yum install -y pcre pcre-devel zlib zlib-devel openssl openssl-devel libxml2-devel libxslt-devel gd-devel GeoIP-devel

    useradd nginx
    groupadd nginx

    cd /usr/local/src
    curl -o /usr/local/src/nginx-1.4.2.tar.gz http://nginx.org/download/nginx-1.4.2.tar.gz
    tar zxvf nginx-1.4.2.tar.gz
    cd nginx-1.4.2
    ./configure --prefix=/etc/nginx \
    --user=nginx \
    --group=nginx \
    --sbin-path=/usr/sbin/nginx \
    --conf-path=/etc/nginx/nginx.conf \
    --error-log-path=/var/log/nginx/error.log \
    --http-client-body-temp-path=/var/lib/nginx/body \
    --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
    --http-log-path=/var/log/nginx/access.log \
    --http-proxy-temp-path=/var/lib/nginx/proxy \
    --http-scgi-temp-path=/var/lib/nginx/scgi \
    --http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
    --lock-path=/var/lock/nginx.lock \
    --pid-path=/var/run/nginx.pid \
    --with-pcre-jit \
    --with-debug \
    --with-http_addition_module \
    --with-http_dav_module \
    --with-http_geoip_module \
    --with-http_gzip_static_module \
    --with-http_image_filter_module \
    --with-http_realip_module \
    --with-http_stub_status_module \
    --with-http_ssl_module \
    --with-http_sub_module \
    --with-http_xslt_module \
    --with-ipv6 \
    --with-sha1=/usr/include/openssl \
    --with-md5=/usr/include/openssl \
    --with-mail \
    --with-mail_ssl_module

    make
    make install

    curl -o /etc/init.d/nginx https://gist.github.com/pacojp/5720689/raw/
    chmod 755 /etc/init.d/nginx

    # mkdir -p /etc/nginx/sites-available
    # mkdir -p /etc/nginx/sites-enabled
    mkdir -p /etc/nginx/conf.d

    mkdir -p /var/log/nginx
    chown nginx:root /var/log/nginx