To do this, go to:
/etc/hosts/
It will look like this:
127.0.0.1 localhost
You need to update this file so your browser knows to look locally for the domain. Add a line for your domain name...
127.0.0.1 domainOR
127.0.0.1 domain2.loc
Next you need to tell apache about your new domain. Go to /etc/apache2/sites-available/ and create a file for your new domain. Since my new domain is literally "domain" that's what I will call my file, with no file extension. Within that file I'll put this....
NameVirtualHost domain:80
<VirtualHost domain:80>
ServerName domain
DocumentRoot /var/www/domain/
</VirtualHost>
Once you've got this setup you're good to go. All you need to do is restart apache...
/etc/init.d/apache2 restart
Now I can access this local domain by simply typing http://domain/ and it won't effect the users browsing my site.
No comments:
Post a Comment