
Question: I want to setup my own server. What software and tools will I need?
Answer: The first major decision to make after you have purchased server hardware is what operating system to use. Many servers come with one already, but if yours does not, you will need to decide on one. Linux or other Unix variants, such as BSD or Solaris are by far the most popular, but there are also many Windows servers out there. If you are on a limited budget, go with a free Linux distribution, such as CentOS.
The next thing to choose is the web server. Choices include Apache, Nginx, and Lighttpd. After that, you will probably one a database server such as MySQL or PostgreSQL Finally, you will want a web-based control panel. Depending on the one you choose, it might also install its own versions of Apache, PHP, and MySQL.
There are many control panel solutions on the market, and most of them are commercial. Popular control panels includ cPanel and Plesk. There are also free solutions available like Virtualmin. Decide what you need for whatever type of websites you plan to have and then choose the software that meets those needs.
Photo: Flickr

With a name that even sounds like the beautiful love interest of a secret affair, Cassandra appears to be positioning itself to steal the hearts of those once in love with MySQL. Twitter is now set to replace its MySQLdatabase system with the open source home wrecker.
Cassandra was originally developed by Facebook and was released to the public via Google’s code repository in 2008. In 2009, the Apache Foundation added it to its project, and in February of 2010, Apache made it a top-level project. It is designed to work with large amounts of data by spreading the data across multiple servers. Its notable feature is that it has no single point of failure.
Twitter joined a growing list of major companies that have adopted Cassandra. Among them are Digg, Cisco, IBM. Cassandra is free and open source software released under the Apache License 2 and is available for download from Apache.org.
Photo: Flickr
Continue reading: Twitter the latest among big players to leave MySQL for Cassandra
Problem: Apache HTTP Server on a web hosting system will undoubtedly run multiple virtual hosts. Each of those virtual hosts logs its activity in a separate location making it impossible to effectively monitor each log and each virtual host for errors or security issues.
Solution: Use mod_status to monitor Apache’s activities. This module for Apache allows the system administrator to have real-time viewing of all of the web server’s activity. It is part of the default Apache 2 package on many Linux systems, and you can enable it by doing the following:
1. Make sure you have mod_info module loaded:
a2nmod info
Nginx (pronounced “Engine X”) is a lightweight web server that offers speed and flexibility without all of the extra features that larger web servers like Apache offer. Although it is a free and open source application, CentOS does not offer the latest version in its default YUM repository. To install it, you need to add the EPEL (Extra Packages for Enterprise Linux) repository, which is part of the Fedora Project.
1. Install the EPEL repository:
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5Server/x86_64/epel-release-5-3.noarch.rpm
2. Install nginx
# yum install nginx
3. You will be asked to install the gpg-key for EPEL. Answer yes
4. Start Nginx
# /etc/init.d/nginx start
5. Check the installation by going to your web server’s default site, either using your ip address or domain name.

Over the past year, we have discussed several web servers. For your convenience, here is a quick list of each one we have already mentioned, as well as a couple we did not, including links to their project sites.
Apache - This is the most widely used and the one we have spent the most time covering. It is free and open source and runs on nearly every platform available. It is released under the Apache license.
Microsoft IIS - As Microsoft’s proprietary web server, it only comes with and works on Windows. If for some reason you have to run this but do not have Windows, you will have to consider virtualization.
Sun Java System Web Server - This is Sun’s proprietary web server technology that is primarily intended for Sun appliances. Nevertheless, it is cross-platform, and Sun recently opened some of its code under a BSD license.
Ngnix - This is a lightweight web server that runs on both Unix and Windows machines. It has become the fourth most popular HTTP server and is available under a BSD-style license.
Lighttpd - This lightweight HTTP server is designed to take on heavy loads while maintaining a good balance, low memory and CPU usage. It powers YouTube, Wikipedia, and many other high-traffic sites. It is free and open source under a BSD style license.
Photo: Flickr

Question: I have been setting up my own server, and a lot of help documents refer to the 127.0.0.1 address. What is 127.0.0.1?
Answer: 127.0.0.1 is the standard ip address assigned to the lookback network interface in IPv4. Because it is a standard, all server should conform to it, and you should be able to access any open ports on your own server through that address. It is also known by the hostname “localhost”, and it is actually more common for documentation to use localhost just in case a server happens to use a different ip address.
If you are running Apache on a local machine, you can use 127.0.0.1 or localhost to access it through a web browser or other method. It is also used by MySQL, CUPS, and many other services, all using their own various ports. Even if no other network devices are setup on a Linux server, the “lo” loopback device should still be present. To find out information about it, you can type “ifconfig” from the command line. It should produce output that looks something like this:
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:49476 errors:0 dropped:0 overruns:0 frame:0
TX packets:49476 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:9790315 (9.7 MB) TX bytes:9790315 (9.7 MB)
Photo Source: Flickr
Question: How do I restart Apache HTTP Server on a Mac OS X server?
Answer: Linux other Unix-based servers, you can start and stop Apache from the command line. If you are familiar with Redhat-based systems, then you are used to logging in and then using “su” to become Root. Mac OS Xrelies on “sudo” like many Debian-based systems (such as Ubuntu).
The command for Apache in Mac OS X is “apachectl” (Apache control). To restart Apache, type the following:
$ sudo apachectl restart
To stop Apache, enter:
$ sudo apachectl -k stop
And to start Apache again, type:
$ sudo apachectl -k start
After entering a command with “sudo” you will be prompted for your password. Enter it and continue. You will still need to use “sudo” for each command run as Root, but it will not ask you for the password again until you have stopped using it for a period of time in that session.
Source: nixCraft

Apache HTTP Server gives you the flexibility to decide where you want to store the web-accessible files for your websites. Most operating systems have their own unique directory structure for their default web server installations, but even those can be changed. The Apache default document root is /usr/local/apache/htdocs.
To change the document root, use the following directive in your httpd.conf or virtual host configuration file:
DocumentRoot directory-path
Replace “directory-path” with the path you want to use. For example:
DocumentRoot /var/www/public_html
Make sure you do not have a trailing slash. With this setup, a file, such as index.html, found in /var/www/public_html/index.html will appear on the web at: http://www.yourdomain.com/index.html. Whatever directory you choose must be readable (but not writable) by outside users.
Source: Apache.org
So far we have covered Linux, Windows, BSD, and Solaris. Another server operating system worth mentioning is Mac OS X Server. Although most tend to think of OS X as a desktop OS, there is a server version that has the same Unix-like structure and stability as other BSD distributions. The main difference is that it has customized visual configuration utilities.
A virtual host allows an administrator to host multiple websites on a single box. By default, Apache will only host one site. There are three steps to configuring a virtual host in Apache. They are:
1. Edit the DNS
2. Create the stie folder
3. Configure the virtual host
This is standard for Apache, but the process differs depending on the operating system. For example, on Mac OS X, the default folder for websites is /Library/WebServer, which is drastically different from the /var/www common on many Linux distributions. You can change this setting and many others to suit your preferences. For the the full how-to wiki article, see macos-x-server.com.
Source: macos-x-server.com”>macos-x-server.com
Continue reading: How to setup a virtual host in Apache on a Mac OS X Server

Cookies are very important for dynamic websites. They allow you to set parameters for user interaction. With cookies, your website can remember visitors and show them appropriate data, ads, and even specific pages. By default, cookies only last for a single browser session. With the CookieExpires Apache directive, you can set the length of time.
With a dedicated server, you can put the directive into your Apache configuration file, but this is not an ideal setup because it will control cookies for all websites on the server. The better method is to use an .htaccess file for each site.
Add the directive to your .htaccess file or create a new file:
CookieExpires expiry-period
Replace “expiry-period” with the number of seconds (i.e. 432,000 for 5 days) or you can insert as follows:
CookieExpires 2 weeks 3 days 7 hours
Source: Apache.org

Continuing with our tour of server operating systems, today we will take a look at Sun Microsystems’ OpenSolaris, the free and open source version of the popular Unix-based Solaris OS. Those who experience with other Unix or Linux servers should find much of OpenSolaris familiar. Nevertheless, there are some key differences.
One of the first things you will want to do with a new OpenSolaris dedicated server would be to install software. The command for installing packages is “pkg”. For example, if you wanted to install mysql, you would type from the command line:
pfexec pkg install SUNWmysql
To install the complete PHP, MySQL, and Apache stack, install the meta package called “amp”.
pfexec pkg install amp
The same command “pkg install” can be used for upgrading packages, and it will automatically upgrade any of the packages dependencies as well. For more information about installing packages in OpenSolaris, see the Sun website.
Continue reading: Installing software on an OpenSolaris server

Continuing with our series this week on non-Linux operating system servers, today we will learn about FreeBSD. Its proponents (of BSD distributions in general) call it the most secure and reliable operating system for Internet-connected servers. It comes with several different versions of Apache. Here is a quick guide to getting the one you want installed.
1. Make sure your ports collection is up to date:
# portsnap fetch update
2. Using ports, install Apache (2.2 in this example):
# cd /usr/ports/www/apache22/
# make install clean
It will take a minute to go through the installation, but it will ask you configuration options. You will also need to configure the Apache httpd.conf file as you would on a Linux server. If you would like a more in-depth guide to the specifics of that configuration, see the nixCraft article on the subject.