helpTips="Usage: php-link-tool [options] [path] php-link-tool link [path] Link to a new project php-link-tool unlink [name] Unlink a project"
if [ $# -lt 1 ]; thenecho"$helpTips" && exit 1; fi if [ "$1" != "link" ] && [ "$1" != "unlink" ]; thenecho"$helpTips" && exit 1; fi
case$1in "link") if [ "$(docker images -q base/php-openresty:2.0.1)" = "" ]; then echo"Run install.sh to initialize the environment" && exit 1; fi
if [ $# -gt 1 ]; then path=$2; else path=$(pwd); fi containerName=${path##*/} if [ "$(docker ps -aq -f name="$containerName")" != "" ]; then if [ "$(docker inspect --format '{{.State.Running}}' "$containerName")" = "false" ]; then docker rm "$containerName" else echo"The $containerName project is already running, To disable this function, run the php-link-tool unlink <name> command" && exit 1 fi fi
sudo sed -i '' -e 's/^#\(LoadModule.*mod_proxy_http.so\)$/\1/g' /private/etc/apache2/httpd.conf sudo sed -i '' -e 's/^#\(LoadModule.*mod_proxy.so\)$/\1/g' /private/etc/apache2/httpd.conf sudo sed -i '' -e 's/^#\(LoadModule.*mod_ssl.so\)$/\1/g' /private/etc/apache2/httpd.conf sudo sed -i '' -e 's/^#\(LoadModule.*mod_vhost_alias.so\)$/\1/g' /private/etc/apache2/httpd.conf sudo sed -i '' -e 's/^#\(Include.*vhosts.conf\)$/\1/g' /private/etc/apache2/httpd.conf
echo'Include /private/etc/apache2/vhosts/*.conf' | sudo tee -a /private/etc/apache2/httpd.conf > /dev/null echo'SSLProxyEngine on' | sudo tee -a /private/etc/apache2/httpd.conf > /dev/null