HowTo – Using A Local Development Web Server

Filed under: Site Management

As a designer you may depend on your Web Host to setup and manage the servers and software that runs the backend of your website but there are ways you can replicate much of what you need on your home or work computer to allow you to prototype changes locally and keep your main site running while you work out the bugs.

If you are working on a Windows, Linux, Mac desktop you have a variety of different package installers to make your life easier. One of the easier products is XAMPP by Apache Friends which will install a basic Apache web server along with PHP, Mysql and a few other products you may not use but are nice to have.

http://www.apachefriends.org

If you need support for Python or other products you can download them individually.

I strongly suggest you download and install the most recent version of Perl and install it and not rely on mod_perl packages that run a subset of all of the modules available in a full perl distribution.

Package Installer Problems

When you are using a package installer you may find that you have problems with services starting or modifying the default directory that the package wants to install to. Often these things are bugs that can be worked out by hitting support sites for the projects but if you are in a hurry you may just need to use the default setup until you can work your way through them yourself.

Where to install

There are many reasons to keep your web servers off of your main drive. If you can you should partition and delegate a drive large enough to hold everything you need however some packages like python and perl like to be on the root drive in windows. For other operating systems you will need to install packages where the os needs to place them.

Firewall Restrictions

Since your server will be private you want to implement firewall restrictions that only allow local connections.  Base package installs are not considered locked down as you will find in your web host environment so guarding against connections to your computer will reduce the possibility of remote exploits.

It may also be a requirement by your isp. Most isps that serve residential customers scan their network for open servers. If they find one on your computer you may risk loss of your account or at least a letter in the mail complaining about it.

If you do need to open your server for remote connections use the highest restrictions available and don’t install servers that you don’t need. There is probably no need for a mail or ftp server so just dont install it and you won’t have to worry about configuring or monitoring it for problems.

Configuration

There are a number of configuration settings that you will need to enable for your websites to work correctly.

In apache you will want to setup your vhosts.conf file using local ips from 127.0.0.1 to 127.0.0.254 for each domain you want to host.

When setting up domains I usually use the root domain name in my windows host file (windowssystem32driversetchost) to assign my sites.

if I have a deployed site named www.mysite.com

I will assign ip 127.0.0.1 to mysite

In this way the host file won’t override my main site out on the internet but it is still easy to get to by navigating to http://mysite

You may need to change memory settings in both apache and php to allow your website applications to work and most likely if you are using some special feature you will need to install the module or enable it by removing the pound signs in your php.ini file.

Maintaining Your Sites

Once you have everything working you will need to take special care to mirror everything on the server on your local host.

I often make quick updates on my website to fix CSS or scripts but you may find that the file and database versions begin to get well out of date and your local website needs updating. If you do not do this at the time you make remote changes you should make the changes when you make backups of your websites.

There are many tools that can help you keep your sites up to date but something as simple as FTP or a Backup from your cPanel should be enough.