Skip to content

Instantly share code, notes, and snippets.

@a2ron
Forked from tollmanz/compile-nginx.sh
Last active August 7, 2017 16:30
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 a2ron/608cf3c15fbb81832a1e2cd2f2fae371 to your computer and use it in GitHub Desktop.
Save a2ron/608cf3c15fbb81832a1e2cd2f2fae371 to your computer and use it in GitHub Desktop.
Install NGINX (compiling and adding extra modules)
################################################################################################
# VARS
SOURCES_FOLDER="/opt/"
################################################################################################
# move to folder where we will download the sources
cd $SOURCES_FOLDER
# dependency
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
tar -zxf pcre-8.40.tar.gz
cd pcre-8.40
./configure
make
sudo make install
# dependency
cd $SOURCES_FOLDER
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
sudo make install
# dependency
cd cd $SOURCES_FOLDER
wget http://www.openssl.org/source/openssl-1.0.2f.tar.gz
tar -zxf openssl-1.0.2f.tar.gz
cd openssl-1.0.2f
./configure darwin64-x86_64-cc --prefix=/usr
make
sudo make install
# nginx source code
cd $SOURCES_FOLDER
wget http://nginx.org/download/nginx-1.11.13.tar.gz
tar zxf nginx-1.11.13.tar.gz
cd nginx-1.11.13
./configure
--sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pidf \
--with-pcre=../pcre-8.40f \
--with-zlib=../zlib-1.2.11f \
--with-http_ssl_modulef \
--with-streamf \
--with-mail=dynamicf \
--add-module=/usr/build/nginx-rtmp-modulef \
--add-dynamic-module=/usr/build/3party_modulef \
--with-http_sub_module \
--with-http_ssl_module
make
################################################################################################
MANUAL STEPS
################################################################################################
# edit the DEAMON with the correct new path, which is now /usr/local/nginx/nginx
nano /etc/init.d/nginx
# reboot
# service nginx start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment