Skip to content

Instantly share code, notes, and snippets.

@devynspencer
Created October 23, 2015 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devynspencer/dd8b767719a0051f875d to your computer and use it in GitHub Desktop.
Save devynspencer/dd8b767719a0051f875d to your computer and use it in GitHub Desktop.
Install nginx
#!/bin/bash
yum -y install gcc gcc-c++ make zlib-devel pcre-devel openssl-devel
version="${1:-1.8.0}"
config="${2:-$(pwd)/nginx.conf.default}"
cd /tmp
wget http://nginx.org/download/nginx-$version.tar.gz
tar -xzf nginx-$version.tar.gz
rm nginx # removes the soft link
cd nginx-$version
./configure \
--user=nginx \
--group=nginx \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-debug \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-pcre \
--with-file-aio \
--with-http_realip_module \
--with-http_addition_module \
--without-http_scgi_module \
--without-http_uwsgi_module \
--without-http_fastcgi_module
make
make install
rm -rf /etc/init.d/nginx
wget -O /etc/init.d/nginx https://gist.github.com/sairam/5892520/raw/b8195a71e944d46271c8a49f2717f70bcd04bf1a/etc-init.d-nginx
chmod +x /etc/init.d/nginx
chkconfig --add nginx
chkconfig --level 345 nginx on
cd -
cp $config /etc/nginx/nginx.conf
service nginx restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment