Last active
December 18, 2015 01:29
-
-
Save pacojp/5704628 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment