Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 46 lines (37 sloc) 1.09 KB
#!/usr/bin/env bash
# Usage: prax install
# Summary: Installs Prax proxy server (requires sudo privilege)
set -e
EXT="$PRAX_ROOT/ext"
INSTALL="$PRAX_ROOT/install"
HOSTS="$HOME/.prax"
cd "$EXT"
echo "Installing NSSwitch extension (to resolve .dev domains)"
sudo make
sudo make install
sudo sed -i -r -e '/\bprax\b/ !s/^hosts:(.+)\bdns\b/hosts:\1prax dns/' /etc/nsswitch.conf
cd "$PRAX_ROOT"
echo "Installing Prax firewall rules"
sudo cp "$INSTALL/initd" /etc/init.d/prax
sudo chmod +x /etc/init.d/prax
sudo update-rc.d prax defaults
sudo /etc/init.d/prax start
echo "Creating ~/.prax directory"
if [ ! -d "$HOSTS" ]; then
mkdir "$HOSTS"
fi
echo "Symlinking prax into /usr/local/bin"
sudo ln -sf "$PRAX_ROOT/bin/prax" /usr/local/bin/prax
echo "Generating SSL key and certificate"
cd ./ssl/
./generate.sh
cd - > /dev/null
echo "Starting prax server"
prax start
echo ""
echo "Prax is now ready. First restart your browser (for the NSSwitch extension"
echo "to be used). Then link your apps to it:"
echo
echo " $ ln -sf ~/Work/myapp ~/.prax/"
echo
echo "Eventually point your browser to http://myapp.dev/"