Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alsyundawy/3d91e44697e33b8ba5b0caea7187383c to your computer and use it in GitHub Desktop.
Save alsyundawy/3d91e44697e33b8ba5b0caea7187383c to your computer and use it in GitHub Desktop.
# Based on CentOS7 fork of @smartmadsoft: https://gist.github.com/moneytoo/ab3f34e4fddc2110675952f8280f49c5
# "6" for CentOS6 or Amazon Linux, "7" for CentOS7
CENTVER="6"
OPENSSL="openssl-1.0.2j"
NGINX="nginx-1.10.2"
yum clean all
# Install epel packages (required for GeoIP-devel)
yum -y install http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum -y groupinstall 'Development Tools'
yum -y install wget openssl-devel libxml2-devel libxslt-devel gd-devel perl-ExtUtils-Embed GeoIP-devel pcre-devel
useradd builder
groupadd builder
mkdir -p /opt/lib
# Untar, but don't compile openssl to /opt/lib
wget https://www.openssl.org/source/$OPENSSL.tar.gz -O /opt/lib/$OPENSSL.tar.gz
tar -zxvf /opt/lib/open* -C /opt/lib
# Build source nginx (no auto-updates), statically link to /opt/lib/openssl* (no OS effects)
rpm -ivh http://nginx.org/packages/centos/$CENTVER/SRPMS/$NGINX.el$CENTVER.ngx.src.rpm
sed -i "s|--with-http_ssl_module|--with-http_ssl_module --with-openssl=/opt/lib/$OPENSSL|g" /root/rpmbuild/SPECS/nginx.spec
# Compile it
rpmbuild -ba /root/rpmbuild/SPECS/nginx.spec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment