Skip to content

Instantly share code, notes, and snippets.

@nk952777
Forked from m1st0/php_build_ubuntu.sh
Last active February 17, 2017 17:12
Show Gist options
  • Save nk952777/1731e01486b3e28aee57a1a6360145af to your computer and use it in GitHub Desktop.
Save nk952777/1731e01486b3e28aee57a1a6360145af to your computer and use it in GitHub Desktop.
Compiling PHP 7 And Setup HHVM on Ubuntu 14.04/16.04 with Various Supported Modules
#! /bin/bash
wget --content-disposition ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
tar -zxvf pcre-8.40.tar.gz
apt-get -y update
apt-get -y install git
apt-get -y install openssl libssl-dev
apt-get -y install build-essential autoconf automake libtool bison re2c
# Nginx VTX Module
git clone git://github.com/vozlt/nginx-module-vts.git
wget --content-disposition http://nginx.org/download/nginx-1.10.3.tar.gz
tar zxvf nginx-1.10.3.tar.gz
cd nginx-1.10.3
./configure --prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--modules-path=/usr/lib/nginx/modules \
--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-file-aio \
--with-threads \
--with-ipv6 \
--with-http_addition_module \
--with-http_auth_request_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_mp4_module \
--with-http_random_index_module \
--with-http_realip_module \
--with-http_secure_link_module \
--with-http_slice_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_v2_module \
--with-mail \
--with-mail_ssl_module \
--with-stream \
--with-stream_ssl_module \
--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,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed' \
--with-pcre=$HOME/pcre-8.40 \
--add-module=$HOME/nginx-module-vts
make
make install
mkdir /var/cache/nginx
chmod -R 755 /var/log/nginx
mkdir /etc/nginx/sites-available
mkdir /etc/nginx/sites-enabled
sed -i 's/#user.*nobody;/user www-data;/g' /etc/nginx/nginx.conf
sed -i '20c vhost_traffic_status_zone;' /etc/nginx/nginx.conf
sed -i '47a location /status { \
vhost_traffic_status_display; \
vhost_traffic_status_display_format html; \
}' /etc/nginx/nginx.conf
sed -i '120c include /etc/nginx/sites-enabled/*.conf;' /etc/nginx/nginx.conf
wget https://gist.githubusercontent.com/CHIENPINNWU/889f387a19a95a40d5169345593ba350/raw/1b30dcb421f36e9b1180e070422e45c0df84791e/nginx -O /etc/init.d/nginx
chmod +x /etc/init.d/nginx
/usr/sbin/update-rc.d -f nginx defaults
service nginx start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment