Skip to content

Instantly share code, notes, and snippets.

@joelbowen
Created June 4, 2013 19:28
Show Gist options
  • Save joelbowen/5708786 to your computer and use it in GitHub Desktop.
Save joelbowen/5708786 to your computer and use it in GitHub Desktop.
Using Virtual Hosts on EC2
//Get to the conf.d directory on your EC2
cd /etc/httpd/conf.d
//If this is a fresh install, you'll likely need to create a vhost file
vi vhost.conf
//In insert mode (i), paste the following:
NameVirtualHost *
<VirtualHost *>
ServerName example.com
DocumentRoot /var/www/html/example.com
</VirtualHost>
// NameVirtualHost can be an IP
// The ServerName is the incoming server url
// The DocumentRoot should point to the folder you're using
// Hit ESC and type :wq to write/quit
// DO NOT FORGET TO:
service httpd restart
// If the above doesn't work, check your httpd.conf file to see if
// and virutal hosts block is commented out (#)
// If using Route53, create an A IP record that matches ServerName
// that points to the associated elastic IP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment