Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Setup local test development for your website

Sunday, September 30th, 2012 by Servage

Are you always working online, or maybe even on the live version of your website? There are plenty of reasons not to do that, for example an internet connection may not be around, or you risk corrupting your live website, and break it for potential users. That’s not professional.

Please check out these related blog articles on version control:

Local development environment

If you use a version control system you may not have a centralized development system, or maybe you simply prefer local development. Either way you need to set up a local development environment. If you are a regular web developer, this includes a webserver with script-support and a database server. Typically this is Apache webserver with PHP support and a MySQL database server. Check out XAMPP (or MAMP, for Mac users). Those two bundles offers you a complete ready-to-go local development enivronment.

Setup local domain “myproject.local”

If you’re a Unix user, you can easily setup your system to even support a fictitious local domain, like myproject.local. Simply edit the /etc/hosts file to point the intended domain name to your local IP address (typically 127.0.0.1). See the other entries in the /etc/hosts file for examples and syntax. You can just copy and customize the existing entries.

In your webserver conf (using Apache in this example), you need to setup virtual hosts. Otherwise the webserver will react on any domain name. Setup a virtual host for this example like this:

<VirtualHost *:80>
	ServerName myproject.local
	DocumentRoot /path/to/my/project
	# Other directives here
</VirtualHost>

Developing on a local machine can be a real time saver if using a proper syncing or versioning tool. Happy coding :-)

 

 

Setup local test development for your website, 4.3 out of 5 based on 3 ratings
Categories: Tips & Tricks

Keywords:

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.