Setting up a development server for testing purposes


Setting up a development server for testing purposes.

Most web developers will use a web hosting company to host their websites. It makes perfect sense to outsource the most critical aspect of your web presence to professionals. Web hosting is one area where you can not make do with good, it has to be great.

With that said it can sometimes be very beneficial to have a test bed where you can develop your site locally without having to actually upload your work to your web host. If your site is simply a static site written in html then there really is no need to use anything more than a web browser and place your files in a folder on your computer. But what if you want to be able to test new code and scripts before they are sent to the server. You could simply create a new directory on your web host and use that for development, but then you need to spend time uploading, testing, editing then uploading again, it can be a very time consuming process.

This is the perfect job for a test server. A test server can either be a local server installed on your PC, or a stand alone server on your LAN (local area network) My preferred method is to have a server on your network. That way it is very easy to work from any pc on your network and have direct access to your development server.

Another factor that I think is very important is to choose and configure your development server to be very similar (preferably identical) to the server that is used by your hosting company. I don’t mean the hardware specification, but the software and configuration.

If you can keep your development server as closely configured to your production server then there is less chance of you having compatibility issues when you move your content to the production server.

Your test server can contain all of the features of your production server (in most cases) for example you can install Mysql, PHP and perl to let you test and debug your scripts and code. On Windows servers you can also install ASP for example to let you test your asp/asp.net coding.

The test server I have set up is a Linux box that was originally an old PC. Recycling your old computer into a development server can be a very cost effective way of achieving this without having to spend lots of money in the process.

In terms of your operating system, if you use Linux you can choose to purchase a distribution or in many cases download the distribution from your provider of choice, for example Debain, Suse and Redhat are common Linux providers.

If you want to run a Windows server then it will almost certainly cost you a little more, due to licence costs. In terms of choice, most windows hosts run Windows 2000 or Windows 2003. It is possible to use Windows XP (pro) as your server because it comes with IIS (internet information sever) as an optional extra. However the version that comes with XP pro is a little limited, you can only run one site on it. If it was being used as a web server this means only one site could be hosted. In our development environment this means you can only have one development site hosted on it.

If you run Win 2000 or 2003 you can set up multiple development sites.

It is also possible to install the Apache web server with Windows, although this may not be desirable. Not many hosting companies will offer this combination. Remember we are trying to keep our develop server as close in specification to our production server as possible.

With Linux you are not limited to how many sites you can place on the server. What I tend to do is have an account set up on the server for every site I work on. Then I can access the sites vie http or ftp etc across my network.

What will you need

  • An old PC (or a new one of you are feeling flush!): You can easily convert your old pc to act as a LAN server for testing and development work.
  • A network hub/switch or a router with built in hub/switch: This is the key components that will allow your server to communicate with other computers on your network.
  • Network cards: most modern computers will have at least one of these. Older computers may not have one installed and it may be necessary to acquire and install one. Most NIC cards will work with Linux, but it is important to find out before you buy. Network cards became standard on most computers with the broadband explosion. Older systems may not have had them because connectivity then was generally dial up modem connection.
  • Network cables: You will need these to provide the connection vehicle between your different systems. Think of this as your “tiny internet”. The exception to the rule is if you use wireless technology. In this case you will need a wireless router and a wireless network card for each system.
  • An operating system: Windows or Linux, use what is currently deployed on your production web server. Deployment
    Once you have everything physically in place it is time to actually set up the server. Your first step will be to install the operating system. Either from a CD(s) Windows/Linux or online using an ISO image (Linux).

    Installing an operating system can (as you know) take a little time but is generally pretty straight forward. During install windows will ask you some questions and ask for a product key. Linux will ask you for package information. At this point you may want to pick your software options such as apache, PHP, Mysql perl etc. You can however opt to wait until you have a functioning system and add your packages then.

    Select the Apache web server and an FTP server. Common examples will be Vsftp (Very secure ftp) or Proftp. Both are very good FTP servers. Choose one and select it to be installed.

    It is also a good idea to install the apache docs. Not only does this give you plenty of reading. It also gives you plenty of pages to serve for testing purposes.

    Windows is different. You will need to add all third party software and applications after you have a functional system. Windows ships with only the operating system and a mostly MS tools. Linux distros on the other hand contain literally thousands of opensource projects.

    The procedure for installing software on Linux is different to windows. Most Linux distributions will come with a package manager or control panel. The terminology tends to vary from product to product.

    A package manager is a very useful tool. It enables you to install a wide range of applications and not worry about dependencies. A good example is “Yast” that comes with Suse Linux. It allows you to install software using a GUI (Graphical user interface). It allows you to search for software that is included with the distributions cd’s. You can then select what packages you wish to install and it does it for you.

    Most Linux companies provide similar package managers for their distributions. This makes it so much easier to manage your system. With Linux a lot of software relies on other pieces of software for it to work. This can be a real headache. Package managers take care of this by installing everything you need to run your chosen applications.

    Setting up connectivity
    My LAN test servers have always been Linux based. Linux is he most common operating system used by web hosting companies because of this I have went into a lot more detail with regards to setting up a Linux server. If you have an existing network then it really is as simple as plugging an extra network cable from your existing LAN into your “new” server. This will make the physical connection. You now need to configure your servers connection settings.

    There are things you will need to know.

  • Your router IP address
  • The IP address you wish to assign to the server
  • The subnet that your server will reside on.
  • Name server 1 address
  • Name server 2 address At this stage I am assuming you have a computer system set up and running a Linux operating system. Your system already has a web server and an FTP server installed. Before we can even think about viewing anything across the local area network we need to enable the server to connect to the network. The first thing you should do is to access your Linux system control centre. If you are using Suse Linux this tool will be called Yast or Yast2. Almost all Linux distributions will have some form of Control tool that allows you to configure your system using a user interface.
    If you are unsure please have a look through the manual that came with your Linux software or consult their website.

    The first configuration option that we want to access is network settings. From there we will tell the server how to become part of our network. You should choose static ip address. and give your server an IP that is logical to your existing network. For example if your router is 192.168.1.0 and your PC is 192.168.1.1 you should assign 192.168.1.2 to your server.

    The layout of your network settings properties box will vary depending on what version of Linux you are using. Typically you will be asked for 2 name servers (these should be provided by your ISP) an ip address, possibly a subnet address and a gateway address.

    The gateway address is the internal IP address of your router. Once you insert your correct details save your settings. In theory, and if all went well you Should now have your server running on the network and capable of serving a development site.

    Go to another pc on your network and type in the ip of the server and see what happens. (remember [)…] If you see the apache test page then you have successfully set up your server if not then we need to take a step back.

    The most common reason for the page not showing is apache is not running. open your shell (console) and type

    apachectl start

    It should talk back to you by saying “httpd started”. If it does this then return to your other computer and try to access your server again. If it works then this time you are in luck. If not then you need to check a few things.

    The obvious thing to check is that your network cables are all correctly attached. You should then double check your network settings in the Linux control area. Because there are so many different variations of Linux is is impossible to cover them all in any great detail. I am only able to talk in very general terms. Please consult any documentations that came with your Linux distribution. There may also be help available from within your control area.

    If you are now able to view your test server from other computers on your network then you are ready to proceed to the next stages
    It is not very often (if ever) that I will recommend a tool or app but in this case I will break with tradition and recommend a free server application called Webmin.

    Webmin is a server control panel that is designed for server administrators. it is not a control panel like Cpanel that was developed for the hosting industry. It is designed to enable you to configure your system, start stop services and edit your configuration files using a web browser. Once you get to know this tool it will really help you and and speed up system administration. I will not go into any detail about installing Webmin because the documentation and instructions provided are excellent. www.webmin.com

    What you will notice when you access your Webmin install is that it allows you to start and stop almost any service without having to physically go to the server, or shell into the server. You simple click on servers and all your options will be displayed. Lets click on proftp ftp server. At the very bottom of the page you will see a button “start proftpd” click this button and your ftp server will start.

    How lets imaging you are working on a website called “Car site” what I would tend to do now is create a user account on the server called “car”. Again this is done through your Linux control tool. You will be asked for a user name password and perhaps some additional information about the new user. Once the account has been created you will have a fully functional Linux user account called “car”

    You should then set up a virtual host for your account Placing the following on your httpd.conf will set up a name based virtual host.


    <VirtualHost *>
    ServerName car
    DocumentRoot /home/car/public_html/
    ScriptAlias /cgi-bin/ /home/car/public_html/cgi-bin/
    </VirtualHost>

    <VirtualHost *> — The first line is simple the opening tag for the virtual host.

    ServerName car — This specifies the name of the user account. It can in theory be anything but it makes since to use the same name as the user account.

    DocumentRoot /home/car/public_html/ — specifies where about on the system the users web documents will be stored.

    ScriptAlias /cgi-bin/ /home/car/public_html/cgi-bin/ specifies the locating of the users cgi-bin. This entry will not actually create the cgi-bin you will still need to create the actual folder (public_html/cgi-bin) either using Shell or an ftp client.

    </VirtualHost> — the end tag of the virtual host.

    You can set this up entirely through the Webmin control panel but this is one area where I feel it is probably quicker to simply use shell.

    Always make a backup of your httpd.conf file before you make any changes.

    You will then need to restart apache for the changes to take effect. You can do this through Webmin or by running the following in shell as user root…

    apachectl restart

    In order to access this users web space account you can visit server.ip.address/~car.

    On Linux system level the same location will be hosed at /home/car/public_html You should be able to ftp into your server and log in using the username “car” and the password you choose when you created the user account. You should now be able to upload files to the web folder.

    I always think it is a good idea to have a different user account for every development site you work on. This just helps keep everything separate and more importantly it makes it very unlikely you will ftp content into the wrong location if your username is the same as the site name you are working on. I think it is a very bad idea to FTP as user root. The ability to FTP as root is disabled by default, if you do wish to do this you will need to alter your ftp configuration.

    If you wish to take advantage of server side scripting such as PHP or perl you will need to install the languages onto your server. If you want to install it from your Linux distribution you can simply open your Linux control panel and open up your “add software” section. From there you can select PHP and Perl and let your Linux distribution update it’s self by installing the chosen features.

    The other way of installing such packages is to download the latest versions from their related sites and install then manually. Be warned this is a certainly not a task for someone who doesn’t know what they are doing. Be sure to read the documentation provided. Linux is certainly not the easiest operating system to work with, so why make it any harder than you need to.

    Security
    If your are using a router make double sure that your ports are locked down. Make certain that port 80 is closed. If you left port 80 open it is possible for web traffic to enter your development server. This is almost certainly not desired.

    Tips
    You can shorten the URL you use to access your project to simply [car…] by placing the following in your hosts file.


    ser.ver.ip.address/~car car

    On the web servers are required to run 24/7/365. Your development server is only required when you wish to view your development work. You can simply turn it off when not required.

    Having a development server can be of great assistance. For example imaging you have a template driven site and you want to test a new layout. You have 30 or so files that need uploaded to your web server on the other side of the country. maybe a few mins to upload it. On your LAN server this would only take a few seconds. Over a network everything is so much faster. It will also help you to appreciate the hosting that we all take for granted.

    Thanks to Mack Who Wrote this

    For more information Visit http://www.webmasterworld.com/forum48/2432.htm

  • Leave a Reply

    Your email address will not be published. Required fields are marked *


    × six = 48