Last active
March 14, 2017 15:36
-
-
Save nk952777/bfa7415cdf78a9d223e12f3d12ac2c51 to your computer and use it in GitHub Desktop.
LNH ( Linux , Nginx and PHP7 ) Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 | |
sed -i '69,77c location ~ \\.php$ { \ | |
try_files $uri =404; \ | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; \ | |
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; \ | |
fastcgi_index index.php; \ | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; \ | |
include fastcgi_params; \ | |
}' /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 | |
apt-get update | |
#apt-get install -y python-software-properties | |
apt-get install -y language-pack-en-base | |
locale-gen en_US.UTF-8 | |
export LANG=en_US.UTF-8 | |
export LC_ALL=en_US.UTF-8 | |
add-apt-repository ppa:ondrej/php | |
apt-get update | |
apt-get install -y php7.1-fpm php7.1-curl php7.1-mbstring php7.1-mcrypt php7.1-mysql libssl1.0.2 php-common php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-readline php7.1-dev php-memcached | |
nginx -s reload | |
#Phalcon | |
# Stable releases | |
curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | bash | |
apt-get install -y php7.1-phalcon | |
#HHVM | |
#apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449 | |
#add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main" | |
#apt-get update | |
#apt-get -y install hhvm | |
#update-rc.d hhvm defaults | |
#/usr/share/hhvm/install_fastcgi.sh | |
#sed -i '7d' /etc/hhvm/server.ini | |
#sed -i '$a hhvm.server.file_socket=/var/run/hhvm/hhvm.sock' /etc/hhvm/server.ini | |
#sed -i '3d' /etc/nginx/hhvm.conf | |
#sed -i '2a fastcgi_pass unix:/var/run/hhvm/hhvm.sock;' /etc/nginx/hhvm.conf | |
#sed -i '76a include /etc/nginx/hhvm.conf;' /etc/nginx/nginx.conf | |
#service hhvm restart | |
#rm /var/run/hhvm/hhvm.hhbc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment