Skip to content

Instantly share code, notes, and snippets.

@MarkGavalda
Forked from tollmanz/compile-nginx.sh
Last active January 30, 2018 08:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save MarkGavalda/6591c9b92f31f916d19d to your computer and use it in GitHub Desktop.
Save MarkGavalda/6591c9b92f31f916d19d to your computer and use it in GitHub Desktop.
# Modify files:
# src/core/nginx.h
#define NGINX_VER "kinsta-nginx/" NGINX_VERSION
# src/http/ngx_http_header_filter_module.c
#static char ngx_http_server_string[] = "Server: kinsta-nginx" CRLF;
# src/http/ngx_http_special_response.c
# with the provided one + the inclusion html files
# nano auto/install
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install unzip build-essential git checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev -y && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN
cd ~/sources && \
wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_0g.zip && \
unzip OpenSSL_1_1_0g.zip && \
# Get the Nginx source.
cd ~/sources/ && \
wget http://nginx.org/download/nginx-1.13.8.tar.gz && \
tar zxf nginx-1.13.8.tar.gz && \
cd nginx-1.13.8 && \
# nano src/core/nginx.h
# nano src/http/ngx_http_header_filter_module.c
# cd src/http/
# rm ngx_http_special_response.c
# paste custom kinsta ngx_http_special_response.c
# Configure nginx.
./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/lib/nginx/client_temp \
--http-proxy-temp-path=/var/lib/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi_temp \
--user=www-data \
--group=www-data \
--with-pcre-jit \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_realip_module \
--without-http_uwsgi_module \
--without-http_scgi_module \
--without-http_ssi_module \
--without-http_memcached_module \
--without-mail_pop3_module \
--without-mail_smtp_module \
--without-mail_imap_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-file-aio \
--with-threads \
--with-stream \
--with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' \
--with-ld-opt='-Wl,-z,relro -Wl,--as-needed' \
--with-openssl=$HOME/sources/openssl-OpenSSL_1_1_0g && \
# Make the package.
make -j 4 && \
# Create a .deb package.
#
# Instead of running `make install`, create a .deb and install from there. This
# allows you to easily uninstall the package if there are issues.
checkinstall --install=no -y
# Install the package.
#
# apt install megatools
# megaput nginx_1.13.8-1_amd64.deb -u reinerdavid007@yahoo.com -p su7HghpzMj4nKTh
#cd /root
#rm /root/nginx-1*deb
# megaget /Root/nginx_1.13.8-1_amd64.deb -u reinerdavid007@yahoo.com -p su7HghpzMj4nKTh
#mkdir /root/nginx-nov23-1
#cp -r /etc/nginx/* /root/nginx-nov23-1/
#dpkg -i /root/nginx_1.13.8-1_amd64.deb
#rm -r /etc/nginx/*
#cp -r /root/nginx-nov23-1/* /etc/nginx/
#systemctl restart nginx.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment