Skip to content

Instantly share code, notes, and snippets.

@imax
Created July 26, 2014 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imax/8841a7a229ad834e82f1 to your computer and use it in GitHub Desktop.
Save imax/8841a7a229ad834e82f1 to your computer and use it in GitHub Desktop.
I want to be able to access local dev server at local.djinni.co instead of using localhost:8000. You can plug any domain name into via /etc/hosts but using default http port (80) requires some trickery. I used default Apache server with virtual hosts support.
# enable Apache
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
# Vim /private/etc/apache2/httpd.conf
# Enable Virtual Hosts Include
# Vim /private/etc/apache2/extra/httpd-vhosts.conf
<VirtualHost *:80>
ProxyPreserveHost On
ServerName local.djinni.co
<Location />
ProxyPass http://localhost:8000/
ProxyPassReverse http://localhost:8000/
Order allow,deny
Allow from all
</Location>
</VirtualHost>
# Vim /etc/hosts
127.0.0.1 localhost local.djinni.co
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment