Skip to content

Instantly share code, notes, and snippets.

@sherakama
Created January 12, 2017 02:08
Show Gist options
  • Save sherakama/b15e86d0eace3dfa86a5f09b5820378f to your computer and use it in GitHub Desktop.
Save sherakama/b15e86d0eace3dfa86a5f09b5820378f to your computer and use it in GitHub Desktop.
Fire up apache a webserver
#!/bin/bash
# Start up all webserver resources
if [ "$1" = "71" ]; then
echo "Starting with PHP 7.1"
sudo apachectl -k start -f /etc/apache2/httpd-php71.conf
fi
if [ "$1" = "70" ]; then
echo "Starting with PHP 7.0"
sudo apachectl -k start -f /etc/apache2/httpd-php70.conf
fi
#Start Apache with PHP v.#
if [ "$1" = "56" ]; then
echo "Starting with PHP 5.6"
sudo apachectl -k start -f /etc/apache2/httpd-php56.conf
fi
if [ "$1" = "55" ] || [ "$1" = "" ]; then
echo "Starting with PHP 5.5"
sudo apachectl -k start -f /etc/apache2/httpd-php55.conf
fi
if [ "$1" = "54" ]; then
echo "Starting with PHP 5.4"
sudo apachectl -k start -f /etc/apache2/httpd-php54.conf
fi
# if [ "$1" = "53" ]; then
# echo "Starting with PHP 5.3"
# sudo apachectl -k start -f /etc/apache2/httpd-php53.conf
# fi
# if [ "$1" = "533" ]; then
# echo "Starting with PHP 5.3.3"
# sudo apachectl -k start -f /etc/apache2/httpd-php533.conf
# fi
#Enable MySQL
# brew services start mysql
mysql.server start
#boot up memcached buckets if memcache
if [ "$1" = "memcached" ] || [ "$2" = "memcached" ]; then
instances=11
for ((n=1; n<=$instances; n++))
do
((port=(11210+$n)))
memcached -m 24 -p $port -d
echo "started memcache port: " $port
done
fi
#optionally enable varnish reverse proxy
if [ "$1" = "varnish" ] || [ "$2" = "varnish" ]; then
sudo apachectl stop
sudo apachectl -k start -f /etc/apache2/httpd-varnish.conf
sudo varnishd -s file,/tmp,500M -T 127.0.0.1:2000 -f /usr/local/etc/varnish/default.vcl
echo "started Varnish on Port 80 and Moved Apache to 8080"
fi
# To have launchd start varnish3 at login:
# ln -sfv /usr/local/opt/varnish3/*.plist ~/Library/LaunchAgents
# Then to load it for this session
# launchctl load ~/Library/LaunchAgents/homebrew.mxcl.varnish3.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment