Skip to content

Instantly share code, notes, and snippets.

@cmbankester
Last active August 16, 2017 20:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmbankester/421503cefcd3114e39ba to your computer and use it in GitHub Desktop.
Save cmbankester/421503cefcd3114e39ba to your computer and use it in GitHub Desktop.
Nginx w/ Passenger & Ngx Pagespeed
# Install some deps with yum
yum install -y gcc openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel libcurl-devel
# Install ngx_pagespeed
cd /usr/local/src
NPS_VERSION=1.9.32.2
wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${NPS_VERSION}-beta.zip
unzip release-${NPS_VERSION}-beta.zip
cd ngx_pagespeed-release-${NPS_VERSION}-beta/
wget https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz
tar -xzvf ${NPS_VERSION}.tar.gz # extracts to psol/
# Install passenger (& ruby)
PASSENGER_VERSION=4.0.57
RUBY_VERSION=2.2.0
useradd -M passenger
mkdir /opt/passenger
chown passenger:passenger /opt/passenger
cd /opt/passenger
su passenger -c "curl http://s3.amazonaws.com/phusion-passenger/releases/passenger-${PASSENGER_VERSION}.tar.gz | tar xvz"
cd /usr/local/src
git clone https://github.com/sstephenson/ruby-build.git
cd ruby-build
./install.sh
ruby-build $RUBY_VERSION /usr/local/ruby-${RUBY_VERSION} # then add /usr/local/ruby-${RUBY_VERSION}/bin to beginning of PATH
# Install NGINX
cd /usr/local/src
# check http://nginx.org/en/download.html for the latest version
NGINX_VERSION=1.6.2
curl http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar xvz
cd nginx-${NGINX_VERSION}/
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module \
--with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module \
--with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module \
--with-http_auth_request_module --with-mail --with-mail_ssl_module --with-ipv6 --with-http_spdy_module \
--add-module=/opt/passenger/passenger-4.0.57/ext/nginx \
--add-module=/usr/local/src/ngx_pagespeed-release-1.9.32.2-beta
make
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment