Last active
November 27, 2016 23:07
-
-
Save friedemannsommer/adadcf452823b1ddab1a to your computer and use it in GitHub Desktop.
Takes care about installing NGINX, NGINX-RTMP, NGINX-Pagespeed, LibreSSL, PHP, Composer, Laravel, Symfony, Node, NVM, OhMyZSH
This file contains hidden or 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
; php options | |
pid = /var/run/hhvm/pid | |
; hhvm specific | |
hhvm.server.file_socket = /var/run/hhvm/hhvm.sock | |
hhvm.server.type = fastcgi | |
hhvm.server.default_document = index.php | |
hhvm.server.user = www-data | |
hhvm.log.use_log_file = true | |
hhvm.log.file = /var/log/hhvm/error.log | |
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc |
This file contains hidden or 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 | |
set -x | |
# set default local | |
sudo locale-gen en_US.UTF-8 | |
sudo update-locale LANG=en_US.UTF-8 | |
# set default timezone | |
sudo timedatectl set-timezone Europe/Berlin | |
# NGINX (https://nginx.org/) | |
export NGINX_VERSION=1.11.3 | |
# PCRE (http://www.pcre.org/) | |
export VERSION_PCRE=pcre-8.38 | |
# LibreSSL (http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/) | |
export VERSION_LIBRESSL=libressl-2.4.2 | |
export VERSION_NGINX=nginx-$NGINX_VERSION | |
# NGINX PageSpeed (https://github.com/pagespeed/ngx_pagespeed) | |
export NPS_VERSION=1.11.33.3 | |
export VERSION_PAGESPEED=v${NPS_VERSION}-beta | |
# source urls | |
export SOURCE_LIBRESSL=http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/ | |
export SOURCE_PCRE=ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ | |
export SOURCE_NGINX=http://nginx.org/download/ | |
export SOURCE_RTMP=https://github.com/arut/nginx-rtmp-module.git | |
export SOURCE_PAGESPEED=https://github.com/pagespeed/ngx_pagespeed/archive/ | |
# go to user home | |
cd ~ | |
# clean build directory | |
rm -rf build | |
mkdir build | |
# cpu count for faster building | |
NB_PROC=$(grep -c ^processor /proc/cpuinfo) | |
# install required software | |
sudo apt-get update -y | |
sudo apt-get upgrade -y | |
sudo apt-get install -y nano | |
sudo apt-get install -y curl | |
sudo apt-get install -y wget | |
sudo apt-get install -y build-essential | |
sudo apt-get install -y libgd-dev | |
sudo apt-get install -y libgeoip-dev | |
sudo apt-get install -y checkinstall | |
sudo apt-get install -y git | |
sudo apt-get install -y python-software-properties | |
sudo apt-get install -y software-properties-common | |
sudo apt-get install -y htop | |
# download source files | |
wget -qP ./build $SOURCE_PCRE$VERSION_PCRE.tar.gz | |
wget -qP ./build $SOURCE_LIBRESSL$VERSION_LIBRESSL.tar.gz | |
wget -qP ./build $SOURCE_NGINX$VERSION_NGINX.tar.gz | |
wget -qP ./build $SOURCE_PAGESPEED$VERSION_PAGESPEED.tar.gz | |
wget -qP ./build https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz | |
git clone $SOURCE_RTMP ./build/rtmp | |
# extract the source files | |
cd build | |
tar xzf $VERSION_NGINX.tar.gz | |
tar xzf $VERSION_LIBRESSL.tar.gz | |
tar xzf $VERSION_PCRE.tar.gz | |
tar xzf $VERSION_PAGESPEED.tar.gz | |
tar xzf ${NPS_VERSION}.tar.gz -C ngx_pagespeed-${NPS_VERSION}-beta | |
cd ../ | |
# add NGINX directories | |
sudo mkdir -p /var/lib/nginx/ | |
sudo mkdir -p /etc/nginx/sites-available/ | |
sudo mkdir -p /etc/nginx/sites-enabled/ | |
# set Path for LibreSSL and NGINX | |
export BPATH=$(pwd)/build | |
export STATICLIBSSL=$BPATH/$VERSION_LIBRESSL | |
# build LibreSSL | |
cd $STATICLIBSSL | |
sudo ./configure LDFLAGS=-lrt --prefix=${STATICLIBSSL}/.openssl/ && sudo make install-strip -j $NB_PROC | |
# NGINX | |
cd $BPATH/$VERSION_NGINX | |
sudo ./configure --with-openssl=$STATICLIBSSL \ | |
--with-ld-opt="-lrt" \ | |
--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 \ | |
--lock-path=/var/run/nginx.lock \ | |
--pid-path=/var/run/nginx.pid \ | |
--with-pcre=$BPATH/$VERSION_PCRE \ | |
--with-http_ssl_module \ | |
--with-http_v2_module \ | |
--with-file-aio \ | |
--with-threads \ | |
--with-ipv6 \ | |
--with-http_gzip_static_module \ | |
--with-http_stub_status_module \ | |
--without-mail_pop3_module \ | |
--without-mail_smtp_module \ | |
--without-mail_imap_module \ | |
--with-http_image_filter_module \ | |
--http-client-body-temp-path=/var/lib/nginx/body \ | |
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \ | |
--http-proxy-temp-path=/var/lib/nginx/proxy \ | |
--http-scgi-temp-path=/var/lib/nginx/scgi \ | |
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \ | |
--with-debug \ | |
--with-pcre-jit \ | |
--with-http_stub_status_module \ | |
--with-http_realip_module \ | |
--with-http_auth_request_module \ | |
--with-http_addition_module \ | |
--with-http_geoip_module \ | |
--with-http_gzip_static_module \ | |
--add-module=$BPATH/rtmp \ | |
--add-module=$BPATH/ngx_pagespeed-${NPS_VERSION}-beta | |
sudo touch $STATICLIBSSL/.openssl/include/openssl/ssl.h | |
sudo make -j $NB_PROC && sudo checkinstall --pkgname="nginx-libressl" \ | |
--pkgversion="$NGINX_VERSION" \ | |
--provides="nginx" \ | |
--requires="libc6, libpcre3, zlib1g" \ | |
--strip=yes \ | |
--stripso=yes \ | |
--backup=yes \ | |
--install=yes \ | |
-y | |
# goto user directory | |
cd ~ | |
# create nginx service file | |
sudo wget -qO /etc/init.d/nginx https://gist.githubusercontent.com/friedemannsommer/adadcf452823b1ddab1a/raw/nginx-init.d | |
sudo chmod +x /etc/init.d/nginx | |
# overwrite nginx config file | |
sudo wget -qO /etc/nginx/nginx.conf https://gist.githubusercontent.com/friedemannsommer/adadcf452823b1ddab1a/raw/nginx.conf | |
# default nginx server | |
sudo wget -qO /etc/nginx/sites-available/default https://gist.githubusercontent.com/friedemannsommer/adadcf452823b1ddab1a/raw/nginx-server.conf | |
sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default | |
# default pagespeed server | |
sudo wget -qO /etc/nginx/sites-available/pagespeed https://gist.githubusercontent.com/friedemannsommer/adadcf452823b1ddab1a/raw/pagespeed-pages.conf | |
sudo ln -s /etc/nginx/sites-available/pagespeed /etc/nginx/sites-enabled/pagespeed | |
# oh-my-zsh (https://github.com/robbyrussell/oh-my-zsh) | |
sudo apt-get install -y zsh | |
sudo wget -qO- https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sudo zsh | |
# change default OhMyZSH config | |
sudo wget -qO /root/.zshrc https://gist.githubusercontent.com/friedemannsommer/adadcf452823b1ddab1a/raw/zsh.config | |
# node (https://nodejs.org/en/download/package-manager/) | |
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
# nvm (https://github.com/creationix/nvm) | |
wget -qO- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sudo -E bash - | |
# HHVM (https://github.com/facebook/hhvm) | |
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449 | |
sudo add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main" | |
sudo apt-get update -y | |
sudo apt-get install -y hhvm | |
# hhvm config | |
sudo wget -qO /etc/hhvm/server.ini https://gist.githubusercontent.com/friedemannsommer/adadcf452823b1ddab1a/raw/hhvm.conf | |
sudo wget -qO /etc/hhvm/php.ini https://gist.githubusercontent.com/friedemannsommer/adadcf452823b1ddab1a/raw/php.conf | |
# restart hhvm | |
sudo service hhvm restart | |
# install composer (https://getcomposer.org/) | |
wget -qO composer.install https://getcomposer.org/installer | |
hhvm composer.install | |
rm -f composer.install | |
sudo mv composer.phar /usr/local/bin/composer | |
sudo chmod a+x /usr/local/bin/composer | |
# install laravel (https://laravel.com/) | |
composer global require "laravel/installer" | |
# install symfony (https://symfony.com/) | |
sudo wget -qO /usr/local/bin/symfony https://symfony.com/installer | |
sudo chmod a+x /usr/local/bin/symfony | |
# install wp-cli (https://github.com/wp-cli/wp-cli) | |
sudo wget -qO /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
sudo chmod a+x /usr/local/bin/wp | |
# add startup services | |
sudo update-rc.d nginx defaults | |
sudo update-rc.d hhvm defaults | |
# start services | |
sudo service nginx start | |
sudo service hhvm restart |
This file contains hidden or 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/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: nginx init.d dash script for Ubuntu or other *nix. | |
# Description: nginx init.d dash script for Ubuntu or other *nix. | |
### END INIT INFO | |
#------------------------------------------------------------------------------ | |
# nginx - this Debian Almquist shell (dash) script, starts and stops the nginx | |
# daemon for Ubuntu and other *nix releases. | |
# | |
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ | |
# proxy and IMAP/POP3 proxy server. This \ | |
# script will manage the initiation of the \ | |
# server and it's process state. | |
# | |
# processname: nginx | |
# config: /etc/nginx/nginx.conf | |
# pidfile: /var/run/nginx.pid | |
# Provides: nginx | |
# | |
# Author: Jason Giedymin | |
# <jason.giedymin AT gmail.com>. | |
# | |
# Version: 3.9.0 12-MAY-2015 jason.giedymin AT gmail.com | |
# Notes: nginx init.d dash script for Ubuntu. | |
# Tested with: Ubuntu 14.10, nginx-1.7.9 | |
# | |
# This script's project home is: | |
# http://github.com/JasonGiedymin/nginx-init-ubuntu | |
# | |
#------------------------------------------------------------------------------ | |
# MIT X11 License | |
#------------------------------------------------------------------------------ | |
# | |
# Copyright (c) 2008-2013 Jason Giedymin, http://jasongiedymin.com | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the | |
# "Software"), to deal in the Software without restriction, including | |
# without limitation the rights to use, copy, modify, merge, publish, | |
# distribute, sublicense, and/or sell copies of the Software, and to | |
# permit persons to whom the Software is furnished to do so, subject to | |
# the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be | |
# included in all copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
#------------------------------------------------------------------------------ | |
#------------------------------------------------------------------------------ | |
# Functions | |
#------------------------------------------------------------------------------ | |
LSB_FUNC=/lib/lsb/init-functions | |
# Test that init functions exists | |
test -r $LSB_FUNC || { | |
echo "$0: Cannot find $LSB_FUNC! Script exiting." 1>&2 | |
exit 5 | |
} | |
. $LSB_FUNC | |
#------------------------------------------------------------------------------ | |
# Consts | |
#------------------------------------------------------------------------------ | |
# Include nginx defaults if available | |
if [ -f /etc/default/nginx ]; then | |
. /etc/default/nginx | |
fi | |
# Minimize path | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
PS=${PS:-"nginx"} # process name | |
DESCRIPTION=${DESCRIPTION:-"Nginx Server..."} # process description | |
NGINXPATH=${NGINXPATH:-/etc/nginx} # root path where installed | |
DAEMON=${DAEMON:-/usr/sbin/nginx} # path to daemon binary | |
NGINX_CONF_FILE=${NGINX_CONF_FILE:-$NGINXPATH/nginx.conf} # config file path | |
PIDNAME=${PIDNAME:-"nginx"} # lets you do $PS-slave | |
PIDFILE=${PIDFILE:-$PIDNAME.pid} # pid file | |
PIDSPATH=${PIDSPATH:-/var/run} # default pid location, you should change it | |
RUNAS=${RUNAS:-root} # user to run as | |
SCRIPT_OK=0 # ala error codes | |
SCRIPT_ERROR=1 # ala error codes | |
TRUE=1 # boolean | |
FALSE=0 # boolean | |
#------------------------------------------------------------------------------ | |
# Simple Tests | |
#------------------------------------------------------------------------------ | |
# Test if nginx is a file and executable | |
test -x $DAEMON || { | |
echo "$0: You don't have permissions to execute nginx." 1>&2 | |
exit 4 | |
} | |
# You can also set your conditions like so: | |
# set exit condition | |
# set -e | |
#------------------------------------------------------------------------------ | |
# Functions | |
#------------------------------------------------------------------------------ | |
setFilePerms(){ | |
if [ -f $PIDSPATH/$PIDFILE ]; then | |
chmod 400 $PIDSPATH/$PIDFILE | |
fi | |
} | |
configtest() { | |
$DAEMON -t -c $NGINX_CONF_FILE | |
} | |
getPSCount() { | |
return `pgrep -f $PS | wc -l` | |
} | |
isRunning() { | |
if [ $1 ]; then | |
pidof_daemon $1 | |
PID=$? | |
if [ $PID -gt 0 ]; then | |
return 1 | |
else | |
return 0 | |
fi | |
else | |
pidof_daemon | |
PID=$? | |
if [ $PID -gt 0 ]; then | |
return 1 | |
else | |
return 0 | |
fi | |
fi | |
} | |
#courtesy of php-fpm | |
wait_for_pid () { | |
try=0 | |
while test $try -lt 35 ; do | |
case "$1" in | |
'created') | |
if [ -f "$2" ]; then | |
try='' | |
break | |
fi | |
;; | |
'removed') | |
if [ ! -f "$2" ]; then | |
try='' | |
break | |
fi | |
;; | |
esac | |
try=`expr $try + 1` | |
sleep 1 | |
done | |
} | |
status(){ | |
isRunning | |
isAlive=$? | |
if [ "${isAlive}" -eq $TRUE ]; then | |
log_warning_msg "$DESCRIPTION found running with processes: `pidof $PS`" | |
rc=0 | |
else | |
log_warning_msg "$DESCRIPTION is NOT running." | |
rc=3 | |
fi | |
return | |
} | |
removePIDFile(){ | |
if [ $1 ]; then | |
if [ -f $1 ]; then | |
rm -f $1 | |
fi | |
else | |
#Do default removal | |
if [ -f $PIDSPATH/$PIDFILE ]; then | |
rm -f $PIDSPATH/$PIDFILE | |
fi | |
fi | |
} | |
start() { | |
log_daemon_msg "Starting $DESCRIPTION" | |
isRunning | |
isAlive=$? | |
if [ "${isAlive}" -eq $TRUE ]; then | |
log_end_msg $SCRIPT_ERROR | |
rc=0 | |
else | |
start-stop-daemon --start --quiet --chuid \ | |
$RUNAS --pidfile $PIDSPATH/$PIDFILE --exec $DAEMON \ | |
-- -c $NGINX_CONF_FILE | |
status=$? | |
setFilePerms | |
if [ "${status}" -eq 0 ]; then | |
log_end_msg $SCRIPT_OK | |
rc=0 | |
else | |
log_end_msg $SCRIPT_ERROR | |
rc=7 | |
fi | |
fi | |
return | |
} | |
stop() { | |
log_daemon_msg "Stopping $DESCRIPTION" | |
isRunning | |
isAlive=$? | |
if [ "${isAlive}" -eq $TRUE ]; then | |
start-stop-daemon --stop --quiet --pidfile $PIDSPATH/$PIDFILE | |
wait_for_pid 'removed' $PIDSPATH/$PIDFILE | |
if [ -n "$try" ]; then | |
log_end_msg $SCRIPT_ERROR | |
rc=0 # lsb states 1, but under status it is 2 (which is more prescriptive). Deferring to standard. | |
else | |
removePIDFile | |
log_end_msg $SCRIPT_OK | |
rc=0 | |
fi | |
else | |
log_end_msg $SCRIPT_ERROR | |
rc=7 | |
fi | |
return | |
} | |
reload() { | |
configtest || return $? | |
log_daemon_msg "Reloading (via HUP) $DESCRIPTION" | |
isRunning | |
if [ $? -eq $TRUE ]; then | |
kill -HUP `cat $PIDSPATH/$PIDFILE` | |
log_end_msg $SCRIPT_OK | |
rc=0 | |
else | |
log_end_msg $SCRIPT_ERROR | |
rc=7 | |
fi | |
return | |
} | |
quietupgrade() { | |
log_daemon_msg "Peforming Quiet Upgrade $DESCRIPTION" | |
isRunning | |
isAlive=$? | |
if [ "${isAlive}" -eq $TRUE ]; then | |
kill -USR2 `cat $PIDSPATH/$PIDFILE` | |
kill -WINCH `cat $PIDSPATH/$PIDFILE.oldbin` | |
isRunning | |
isAlive=$? | |
if [ "${isAlive}" -eq $TRUE ]; then | |
kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` | |
wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin | |
removePIDFile $PIDSPATH/$PIDFILE.oldbin | |
log_end_msg $SCRIPT_OK | |
rc=0 | |
else | |
log_end_msg $SCRIPT_ERROR | |
log_daemon_msg "ERROR! Reverting back to original $DESCRIPTION" | |
kill -HUP `cat $PIDSPATH/$PIDFILE` | |
kill -TERM `cat $PIDSPATH/$PIDFILE.oldbin` | |
kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` | |
wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin | |
removePIDFile $PIDSPATH/$PIDFILE.oldbin | |
log_end_msg $SCRIPT_OK | |
rc=0 | |
fi | |
else | |
log_end_msg $SCRIPT_ERROR | |
rc=7 | |
fi | |
return | |
} | |
terminate() { | |
log_daemon_msg "Force terminating (via KILL) $DESCRIPTION" | |
PIDS=`pidof $PS` || true | |
[ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` | |
for i in $PIDS; do | |
if [ "$i" = "$PIDS2" ]; then | |
kill $i | |
wait_for_pid 'removed' $PIDSPATH/$PIDFILE | |
removePIDFile | |
fi | |
done | |
log_end_msg $SCRIPT_OK | |
rc=0 | |
} | |
destroy() { | |
log_daemon_msg "Force terminating and may include self (via KILLALL) $DESCRIPTION" | |
killall $PS -q >> /dev/null 2>&1 | |
log_end_msg $SCRIPT_OK | |
rc=0 | |
} | |
pidof_daemon() { | |
PIDS=`pidof $PS` || true | |
[ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` | |
for i in $PIDS; do | |
if [ "$i" = "$PIDS2" ]; then | |
return 1 | |
fi | |
done | |
return 0 | |
} | |
action="$1" | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart|force-reload) | |
stop | |
# if [ $rc -ne 0 ]; then | |
# script_exit | |
# fi | |
sleep 1 | |
start | |
;; | |
reload) | |
$1 | |
;; | |
status) | |
status | |
;; | |
configtest) | |
$1 | |
;; | |
quietupgrade) | |
$1 | |
;; | |
terminate) | |
$1 | |
;; | |
destroy) | |
$1 | |
;; | |
*) | |
FULLPATH=/etc/init.d/$PS | |
echo "Usage: $FULLPATH {start|stop|restart|force-reload|reload|status|configtest|quietupgrade|terminate|destroy}" | |
echo " The 'destroy' command should only be used as a last resort." | |
exit 3 | |
;; | |
esac | |
exit $rc |
This file contains hidden or 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
server { | |
listen 80; | |
listen [::]:80 default ipv6only=on; | |
server_name development.local; | |
root /var/www; | |
index index.php server.php index.hh server.hh index.html index.htm; | |
charset utf-8; | |
error_page 405 =200 $uri; | |
if (!-d $request_filename) { | |
rewrite ^/(.+)/$ /$1 permanent; | |
} | |
location / { | |
try_files $uri $uri/ @rewrite; | |
} | |
location @rewrite { | |
rewrite (.*) /; | |
} | |
location ~ "\.(hh|php)$" { | |
fastcgi_keep_conn on; | |
fastcgi_index index.php; | |
fastcgi_pass unix:/var/run/hhvm/hhvm.sock; | |
include /etc/nginx/fastcgi.conf; | |
} | |
} |
This file contains hidden or 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
user www-data www-data; | |
worker_processes auto; | |
pid /var/run/nginx.pid; | |
lock_file /var/run/nginx.lock; | |
events { | |
worker_connections 512; | |
use epoll; | |
multi_accept on; | |
} | |
http { | |
# default | |
include mime.types; | |
default_type text/plain; | |
chunked_transfer_encoding on; | |
# disk IO | |
aio threads; | |
sendfile off; | |
output_buffers 2 64k; | |
# connection | |
tcp_nopush on; | |
tcp_nodelay on; | |
# timeouts | |
keepalive_timeout 30; | |
client_body_timeout 30; | |
reset_timedout_connection on; | |
# cache | |
etag on; | |
# disk cache | |
open_file_cache max=200000 inactive=15s; | |
open_file_cache_valid 30s; | |
open_file_cache_min_uses 2; | |
open_file_cache_errors on; | |
# compression | |
gzip on; | |
gzip_vary on; | |
gzip_min_length 1024; | |
gzip_proxied expired no-cache no-store private auth; | |
gzip_types text/* application/xml application/json; | |
gzip_disable "MSIE [1-6]\."; | |
# logging | |
access_log off; | |
error_log /var/log/nginx/error.log crit; | |
# pagespeed | |
pagespeed On; | |
pagespeed FileCachePath "/var/cache/ngx_pagespeed/"; | |
pagespeed RewriteLevel CoreFilters; | |
# pagespeed utility | |
pagespeed EnableFilters in_place_optimize_for_browser; | |
# pagespeed images | |
pagespeed EnableFilters responsive_images,resize_images,rewrite_images,insert_image_dimensions,inline_preview_images,resize_mobile_images,lazyload_images; | |
# pagespeed HTML | |
pagespeed EnableFilters combine_heads,move_css_above_scripts,move_css_to_head,include_js_source_maps,collapse_whitespace,insert_dns_prefetch; | |
# pagespeed CSS | |
pagespeed EnableFilters rewrite_css,sprite_images; | |
# pagespeed JS | |
pagespeed EnableFilters add_instrumentation; | |
# pagespeed cache | |
pagespeed EnableCachePurge on; | |
# pagespeed pages | |
pagespeed StatisticsPath /ngx_pagespeed_statistics; | |
pagespeed GlobalStatisticsPath /ngx_pagespeed_global_statistics; | |
pagespeed MessagesPath /ngx_pagespeed_message; | |
pagespeed ConsolePath /ngx_pagespeed_console; | |
pagespeed AdminPath /ngx_pagespeed_admin; | |
pagespeed GlobalAdminPath /ngx_pagespeed_global_admin; | |
include /etc/nginx/sites-enabled/*; | |
} |
This file contains hidden or 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
server { | |
listen 8080; | |
listen [::]:8080 default ipv6only=on; | |
server_name pagespeed.local; | |
root /var/www; | |
charset utf-8; | |
location / { | |
deny all; | |
} | |
location /ngx_pagespeed_statistics { | |
allow 127.0.0.1; | |
allow 192.168.10.1; | |
deny all; | |
} | |
location /ngx_pagespeed_global_statistics { | |
allow 127.0.0.1; | |
allow 192.168.10.1; | |
deny all; | |
} | |
location /ngx_pagespeed_message { | |
allow 127.0.0.1; | |
allow 192.168.10.1; | |
deny all; | |
} | |
location /ngx_pagespeed_console { | |
allow 127.0.0.1; | |
allow 192.168.10.1; | |
deny all; | |
} | |
location ~ ^/ngx_pagespeed_admin { | |
allow 127.0.0.1; | |
allow 192.168.10.1; | |
deny all; | |
} | |
location ~ ^/ngx_pagespeed_global_admin { | |
allow 127.0.0.1; | |
allow 192.168.10.1; | |
deny all; | |
} | |
} |
This file contains hidden or 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
; php options | |
session.save_handler = files | |
session.save_path = /var/lib/hhvm/sessions | |
session.gc_maxlifetime = 1440 | |
display_errors = stdout | |
error_reporting = E_ALL | |
memory_limit = 512M | |
; hhvm specific | |
hhvm.log.level = Warning | |
hhvm.log.always_log_unhandled_exceptions = true | |
hhvm.log.runtime_error_reporting_level = 8191 | |
hhvm.mysql.typed_results = false |
This file contains hidden or 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
# Path to your oh-my-zsh installation. | |
export ZSH=/root/.oh-my-zsh | |
# https://github.com/robbyrussell/oh-my-zsh/tree/master/themes | |
ZSH_THEME="agnoster" | |
# Uncomment the following line to use case-sensitive completion. | |
# CASE_SENSITIVE="true" | |
# Uncomment the following line to use hyphen-insensitive completion. Case | |
# sensitive completion must be off. _ and - will be interchangeable. | |
# HYPHEN_INSENSITIVE="true" | |
# Uncomment the following line to disable bi-weekly auto-update checks. | |
# DISABLE_AUTO_UPDATE="true" | |
# Uncomment the following line to change how often to auto-update (in days). | |
# export UPDATE_ZSH_DAYS=7 | |
# Uncomment the following line to disable colors in ls. | |
# DISABLE_LS_COLORS="true" | |
# Uncomment the following line to disable auto-setting terminal title. | |
# DISABLE_AUTO_TITLE="true" | |
# Uncomment the following line to enable command auto-correction. | |
# ENABLE_CORRECTION="true" | |
# Uncomment the following line to display red dots whilst waiting for completion. | |
# COMPLETION_WAITING_DOTS="true" | |
# Uncomment the following line if you want to disable marking untracked files | |
# under VCS as dirty. This makes repository status check for large repositories | |
# much, much faster. | |
# DISABLE_UNTRACKED_FILES_DIRTY="true" | |
# ZSH_CUSTOM=/path/to/new-custom-folder | |
# https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins | |
plugins=(git npm nvm node composer common-aliases laravel symfony gulp grunt zsh_reload wp-cli ubuntu systemadmin) | |
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | |
source $ZSH/oh-my-zsh.sh | |
export LANG=en_US.UTF-8 | |
export EDITOR='nano' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment