Skip to content

Instantly share code, notes, and snippets.

@shrunyan
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save shrunyan/38b6ae07d0ac0d8c2a36 to your computer and use it in GitHub Desktop.

Select an option

Save shrunyan/38b6ae07d0ac0d8c2a36 to your computer and use it in GitHub Desktop.
Steps to create a local development website

How to Setup a Local Development Website

Instructions from a Macbook pro running OSX 10.10

Create a Project Directory

Either checkout an existing repostiory or create a new one.

Existing:

git clone git@github.com:shrunyan/REPONAME.git PROCJECTNAME/

New:

mkdir /Users/USERNAME/Sites/PROJECTNAME
cd PROJECTNAME
git init

Add a Virtual Host Entry

sudo vi /etc/apache2/extra/httpd-vhosts.conf

This is a very basic virtual host. There are many other options that can be supplied per website.

<VirtualHost *:80>
  ServerAdmin me@stuartrunyan.com
  DocumentRoot "/Users/USERNAME/Sites/PROJECTNAME/www"
  ServerName PROJECTNAME.dev
  ServerAlias www.PROJECTNAME.dev
</VirtualHost>

I like to have my site live inside of a www directory in my repository. That way I can have root level assets which aren't available to be served. eg. config files, readme, etc...

Add a hosts File Entry

sudo vi /etc/hosts

We will need an entry for "www" and non.

127.0.0.1 PROJECTNAME.dev
127.0.0.1 www.PROJECTNAME.dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment