Ubuntu Server – Configure and Run Multiple Websites on One Server

Here’s a simple tutorial to get many websites running on one ubuntu server
Let’s say you have root access to your own server and want to run many websites on it. If you have Ubuntu Server running with Apache, I will show you in a few easy steps how to configure and run as many websites on your server as the load can handle.

Follow these simple instructions and your additional websites will up and running immediately.

Pre-Install Checks
1. You should have Ubuntu Server 8.04 (or later) running.  You can check your Ubuntu server version by typing this in a terminal prompt   cat  /etc/lsb-release
You should see:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION=”Ubuntu 8.04.1″

2. You should have apache2 running. The easiest way to check is from your terminal prompt type
cd /etc/apache2
if you are now in the /etc/apache2 directory, then we can assume it’s on your server.

Simple Steps to run multiple websites
First, prepare the directories on your server to point the new domain you want to add.
I usually do something like this:
/var/www/docs/ is the base
domain-name.com/ is the domain
public for files that are accessible to apache and the world
private for files that are accessible to apache only (like crons, included header files, etc…)
log for a place to log the entries and errors
backup for a place to save files

For example, if you are adding abc.com, you would create the following using terminal
cd /var/www/docs
mkdir abc.com
cd abc.com
mkdir public private log backup

Next, let’s go to apache and tell it we are ready to add more domains to the configuration.

Type in your terminal cd /etc/apache2
open the file (I use vi) vi apache2.conf
Look for

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/
NameVirtualHost *:80

If it isn’t there, add it. Then save the file. (always make a backup before making changes to any server file)

Next, let’s go to the existing website configuration directory and add our new domain
Type in the terminal cd /etc/apache2/sites-available
You’ll probably see a file default or 000-default
Note: The default configuration on apache is what tells the server where to look for index.html each time someone types in the ip address of your server, or the domain name you have already configured. It also tells apache where to log each server event. After you’ve added other domains, you may want to revisit the default file and decide which domain traffic should go to in the event the ip address is entered, and not the domain name itself.

Next, let’s prepare another file to tell apache there’s another domain to look for aside from the default.
Copy the default file to a new file with the name of the additional website(s) you want to run on this server. For example, let’s say you want to have abc.com on this server. you would type this command cp default abc.com

Next, edit the file you’ve just created to point to the directory on your server where you’d like to manage the files for that domain.
My apache config files look like this:


#
ServerAdmin webmaster@abc.com
DocumentRoot /var/www/docs/abc.com/public
ServerName abc.com
ServerAlias www.abc.com

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all


RewriteEngine On
RewriteBase /
ErrorDocument 404 /index.php

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog /var/www/docs/abc.com/log/error.log
LogLevel warn
CustomLog /var/www/docs/abc.com/log/access.log combined
ServerSignature On
Alias /doc/ “/usr/share/doc/”

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128

You will want to edit the file to meet your own needs. I copied mine here as an example. It would be better for you to edit the new file you’ve copied from your default.

Take care to enter the exact directory names of your new domain and make sure nothing is misspelled. Apache is not forgiving at all. When you try to reload apache, if one directory name is missing, the entire apache server will crash until you fix the offending entry.

Once you are sure the configuration file is accurate, save it and let’s move on.
From terminal, type in cd /etc/apache2
Next, type in a2ensite abc.com (the name of your domain instead of abc)
a2ensite is the command that creates a symlink for apache from sites-available to sites-enabled and tells apache you’re ready to accept traffic for this domain
Assuming you typed everything correctly, you should get a message back
Site abc.com installed; run /etc/init.d/apache2 reload to enable.
Then, simply reload apache
If you get
* Reloading web server config apache2 [ OK ]
Then you should be up and running with your new web domain
Put a sample file in your new domain’s public directory.
For example, open a new file index.html vi /var/www/docs/abc.com/public/index.html
edit it with a message like You got to the new domain 🙂
Save the file, then test by typing in your new domain in a web browser and seeing if that message appears.

To add more domains, simply start at the top of this page again.

We have tried to make this primer as straightforward as possible. As with anything, there is always a deeper level of understanding and things you can configure. First, we got the domains up, next we can tackle other issues like security, ports, etc… which will be discussed in future posts.

We hope you have found this useful, please add your comments and suggestions on how to improve the steps provided here.

Increase Contrast VIM editor color scheme

Problem:  Low contrast VIM on SSH and Telnet

If you work over SSH or telnet on VIM (VI) text editor, then you are probably experiencing a low contrast page that’s very hard on the eyes.  I searched all over the net and VIM’s wiki but didn’t find a fix.

Solution: Change setting in VIM’s config file

Continue reading “Increase Contrast VIM editor color scheme”

Parted Magic 4.8 – Linux Partitioning Recovery Tool. Screenshots & Review

Overview
Ever need a quick and free tool for accessing a non-responsive computer?   Have you wanted an easy way to partition multiple drives with a simple graphical tool?  Do you like running Linux from RAM? If you answered yes to any of the above questions, you’ll want to give this nifty tool a closer look.
Parted Magic has an extensive (but not exhaustive) collection of file system tools. The top features set on their website includes:
Format internal and external hard drives. Move, copy, create, delete, expand & shrink hard drive partitions. Clone your hard drive, to create a full backup. Test hard drives for impending failure. Test memory for bad sectors. Benchmark your computer for a performace rating. Securely erase your entire hard drive, wiping it clean from all data. Gives access to non-booting systems allowing you to rescue important data.

Installation
Parted Magic is available on Source Forge which is linked from their website Download Page.
This handy tool comes in several flavors and can be installed from a CD, USB drive, PXE, and as a Grub tool. We took the iso file and installed it on a Live CD. The filesize was ~72MB and downloaded very quickly (from Sourceforge).

Parted Magic
Parted Magic Desktop

First Impressions
Parted Magic booted without a hitch and almost instantly.  The welcome screen offers several choices, including (our selected method) running the entire tool in RAM. The RAM load took about 20 seconds and the CD was ejected. Our Linux machine was now running in RAM and was super-de-duper fast. It felt like sitting in a Porsche. You know something good is going to happen.

The desktop is clean and spartan. There are no applications installed other than what you’ll need for file and disk management. The desktop does include a menu with quick access to all the available tools, and a terminal shell for command line queries.

We tested some disk management and format tasks, and even checked the installed memory on the host computer.  Parted Magic was fast and worked flawlessly.

Installed Applications

Parted Magic includes an assortment of tools to make your disk partitioning and file management go as painlessly as possible.  Installed tools include the partitions editor, and a smart control utility that really takes out the guesswork in salvaging or partitioning drives.  I liked the nice mounted devices display window for easy control of which drives should be mounted in any session.  Check out the gallery of screenshots below for a recap of all the installed tools.  The main menu includes these sub menu categories:  graphics, internet, system tools, and accessories.  Parted Magic also includes GPic View, for quick graphics and images viewing.

Screenshot Gallery


Conclusion

As we say for all our best distro reviews, unless you have the marketing muscle of RedHat or Novel, or the grass roots popularity of Ubuntu, if you want to stand out among the many dozens of available distros, you really need to have a niche.  Parted Magic serves a niche, and it does it’s stated job marvelously.  The installation and running of Parted Magic worked flawlessly, and super-fast.  If you have disk formatting or testing tasks and you can’t accomplish them from your already installed OS, Parted Magic is the way to go.

Google Chrome Beta for Linux Released

Good news for those of us who have been using Firefox as a last resort in our Linux machines. Google has announced the beta release of the mouch-touted browser for the Linux platform. Chrome is said to be faster and lighter than Firefox.

I’ve been using Chrome in pre-beta for quite some time without incident. It is a great step forward for Linux!

For more details and how to get your copy, check out:
http://www.google.com/chrome/intl/en/w00t.html

Programming: IE8 and PHP $ SERVER[‘HTTP REFERER’]

IE Does Not Behave Like Firefox for Many PHP Variables
Forget it, IE doesn’t pass on the PHP referer variable.  You cannot rely on IE for the referer variable.

What’s really frustrating for LAMP programmers is that we often test in Firefox and things look great, and then you jump over to a Windows machine for QA and find out that IE doesn’t behave the same way.

Recently, I had to open a new window with a link from a page on website I was developing.  In order to validate that the new page opened had come from the same domain, I thought to use the referer code that PHP so conveniently keeps as a global session variable  ($ SERVER[‘HTTP REFERER’]).

However, this variable actually is reading from the Apache log of info that was sent in the header from the visitor.  Alas, not all browsers are alike, and hence you cannot rely on this variable to be populated.

Workaround:

It’s messy, but you can always rely on the PHP $_SESSION[‘id’] variable, since that is a server-side variable. It should always perform the same way regardless of the OS or browser that is using the site.

A simple way to check that the page opened has come from the page you sent it would look like this:

Origin page:

1. Populate the session variable:

session_start();
$_SESSION[‘id’] = session_id( );

Link by tagging on the session variable:

LINK to 2nd PAGE ?x= ECHO SESSION ID HERE

2. Next page

session_start(); //make sure to check that session is started
if (isset($_GET[‘x’])){$x=$_GET[‘x’];} //populate the get variable
if($x!=$_SESSION[‘id’]){
//test if the session variable sent from the first page, matches session here
//this area matches, do your things here
}else{
//no match, tell them to try again, etc…
}

Windows 7 Has Bigger Market Share Than All Linux Flavors Combined

Face it, we live in a Windows world.  The Windows 7 OS has been on shelves for nearly two weeks, and according to various reports, it already has taken a 2% market share of all installed OS in the world.

By comparison, Linux OS, in all its flavors and variations, holds less than a 2% market share of installed OS.

Bigger isn’t necessarily better…

Read our review of Windows 7 Ultimate and see why we think it is a lot like Linux OS.

I’m Back with Kubuntu Linux (and Happy as Ever)

It was an uneasy breakup.  Kubuntu and I had parted about two months ago rather abruptly after I had installed 9.02.   After a nearly four year love affair between us, I felt that I had been jaded.  The new KDE 4.1 Plasma desktop was awkward and things just didn’t seem right.

Numerous crashes.  Not knowing where things went.  Applications acting strange.  It was as though I had returned from a vacation to my home and all the rooms had been redecorated.  After much soul-searching and investigation, I decided not to leave the Ubuntu “family” just yet, but to forsake KDE (as I felt they had forsaken me with Plasma) and to move to Gnome with Ubuntu.

From the get-go, Ubuntu seemed familiar and easy to use.  All the elements were in the right place.   It was as though the stars had aligned.  I was happy again as a Linux user.  I was sold on Ubuntu.  I wrote off KDE and Kubuntu.  Sure, there were plenty of pleasant KDE implementations, many better than Kubuntu, like Mandriva and SUSE.  Even Mepis 8.0, with it’s KDE 3.5 was appealing.  But, I had decided to stay with Ubuntu.  It was inertia, and it felt fine.

After about a month of using Ubuntu on Gnome, the cracks in the foundation started appearing.  Where was Klipper!  Amarok didn’t work well.  The Gnome tools felt different than KDE.  The Alsa sound drivers were having problems all the time.  Come to think of it, I missed KDE…

So, after two months, I’m back with Kubuntu.  This time, I’ve installed KDE 4.2.  Many of the kinks of the original Plasma version have been worked out.  I’ve been reunited with all my favorite KDE apps in their native desktop environment.  Even the sound card is working again.  I’m happy to be back.  The only real holdover from my Gnome days is Evolution.  I’ve left Kmail, and for now have taken a real liking to Evolution as the best email app for my needs.

KDE is working on releasing v.4.3.  They are up to RC2, and there are details on the Kubuntu website on how to upgrade your existing KDE desktop within Kubuntu.   If you are still struggling with KDE 4.1, I strongly encourage you to check out at least v.4.2, and/or leapfrog to 4.3.

My next hill to conquer is whether to leap with KDE to another distro such as Mandriva or Open Suse.  There are so many choices out there for Linux users.  But the old adage still rings true – “If it ain’t broke, don’t fix it”.

Let us know about your KDE vs. Gnome vs. Xfce experiences.

Mepis 8.0 Linux – Review and Screenshots

Mepis 8.0 Linux is a Linux distro designed for ease of use and suitable even for beginners.

Mepis is built on Debian 5.0 stable core with the 2.6.27 Linux kernel and comes in a 32bit and 64bit version.

You can download from the Mepis mirror sites here.

Their motto is “SimplyMEPIS just works!”   We decided to give it a try.

The installation disk includes a Live CD so you can try out Mepis before installing it to your hard drive.

KDE 3.5 vs. 4.1

Mepis has chosen to stay with the KDE Desktop 3.5 instead of moving up to the plasma-based 4.x that is already available on many KDE distros.  The differences between 3.5 and 4.1 are major enough in function that Linux really looks and acts differently with each of them.  I have written about my disappointment with the current KDE 4.x desktop in earlier posts, but some of our viewers have commented that the plasma desktop is a major improvement.

The makers of Mepis have probably stuck with 3.5 since it is ostensibly easier to use than the newer version, and Mepis has stated that it is dedicated to ease of use and simplicity.  I think it was a good decision.

Desktop – First Impressions

The desktop is standard KDE 3.5.  The bottom bar has a nice assortment of quick links and system tray information.  It has a clean and pleasant display of menus and easy access to most-used elements.  Nothing shouted out to differentiate Mepis from other simple distros.

Desktop
Desktop

Installed Packages

The menus show software items by function with the package name in parentheses.  For example, Ksnapshot is “Screen Capture Program (Ksnapshot)”.

Internet browsers include Firefox & Konquerer.  The KDE Kmail program is installed along with Kontakt and Korganizer.  For multimedia, Amarok is installed, as you’d expect in a KDE distro.  Mepis also includes the Open Office tools for spreadsheet, word processing, and presentation.

User Manual

As you’d expect for a beginner user-friendly distro, Mepis comes with its very own user manual.  It’s actually quite useful.  Some may consider this a gimmick since popular distros like Ubuntu have so much written documentation online and user forums, that you’re never far from an answer to any question even without a ‘manual’.

User Manual
User Manual

Gallery of Screenshots

Continue reading “Mepis 8.0 Linux – Review and Screenshots”

Google Chrome OS – Boon or Bust?

chrome
Google Chrome

Google recently announced their intentions for launching Google Chrome OS (Operating System).  According to their blog release, the Google Chrome Operating System will first be targetted at Netbook users. Google plans to release their code to Open Source later this year, and make it available commericially in 2010.

On their official blog, Google asks for help from the open source community to accomplish their vision for a lightweight and easy to use Operating System that does not ‘get in the way’ of users.

Pundits will debate the significance of this ambitious release and its timing to coincide with Microsoft’s new Windows 7 OS.  As the established Search Engine leader, Google in recent years has competed for the desktop user on many other fronts.

Google Talk was released in 2005 as an instant messenger client and was tightly integrated with their email service GMail.  According to Comscore reports, Google Talk is still in distant 4th place behind MSN Messenger, Yahoo, and AOL-AIM.

Their Gmail service, although widely regarded as a superior online email tool, is in 3rd place in usage behind Microsoft’s Hotmail, and Yahoo Mail.

Google’s internet browser, Google Chrome, sits in 4th place with a meager 1.8% market share behind the venerable Microsoft Internet Explorer (65%), Firefox (22%), and Apple’s Safari (8%).  Browser Statistics Source

Google Chrome OS – Starting on the right foot?

What we do know about the Chrome OS is that it will be based on the Linux Kernel, and that the user interface will be minimal, coinciding with the Google Chrome Browser. Google will be working with many OEM’s to integrate their netbooks with the new OS.

Google vs. Microsoft or vs. the Linux Community?

Most of the media have concentrated on the impact Google Chrome OS may have on the ever-present Microsoft Windows.  Depending on deals made between Google and major PC manufacturers, we may see new laptops in 2010 being offered with Chrome OS pre-installed instead of Windows.

In a down economy, users may be looking for ways to save money and the Google OS, to be offered free, will ostensibly save on the licensing costs for Windows.  However, as the numbers above indicate, Google does not have a great track record in wooing mass-market PC users to their non-search engine products.

I think that in the months after the first release of Chrome OS, the first users most likely to give it a try will come from the Linux community.  Microsoft is still very entrenched as the default OS.  As far as the Linux community is concerned, even with the plethora of new versions and flavors of Linux being released on a monthly-basis, the competition has served to fortify the community as a whole.

Google’s Chrome OS may finally bring Linux to the forefront as a mainstream viable alternative to Microsoft.  It may not cut away at Microsoft’s stranglehold, but the Linux community will thrive.  If that happens, the biggest winners in this effort will be Linux users.

http://googleblog.blogspot.com/2009/07/introducing-google-chrome-os.html

Vector Linux 6.0 Gold – Review and Screenshots

Vector Linux is a popular Linux Distro whose motto is “speed, performance, stability”.

Version 6.0 was released in February 2009.  Their stated goal is to “Keep it simple, keep it small and let the end user decide.”  Having said that, this end user decided to see what was cooking at Vector.

Xfce Desktop – GNOME packages

The modest but pleasant Xfce Desktop is complemented with a nice array of GNOME packages.

Download

The 700 MB ISO download directly from their website http://vectorlinux.com/downloads was fast and without incident.

Vector also offers a deluxe version, which includes installation support and costs $22.99, available for purchase online at their website  (Note: We are not associated with Vector in any way).

Vector also comes in a KDE version.  The Xfce version reviewed here is targeted at the power user and at users with older hardware looking for a fast Linux that will work without bells and whistles.

Tricky Installation

There is no live CD, so you’ll have to install Vector Linux to begin testing its capabilities.  The installation screens are pretty straight forward for active linux users.  First-timers and users new to Linux may find the installation a bit daunting.  Vector has been around for about 10 years, and the process is polished, however, it’s roots are in Slackware (A Linux distro for advanced users), and it sometimes shows.

Install 3

Most of the questions should be familiar to users who have installed Windows, such as configuring your time zone and language.  You will have to configure a Linux partition on which to install the OS.  There is an automatic configuration option for those who find it too confusing to configure it manually.

Pleasant Desktop, Nice Selection of Installed Apps

Desktop
Desktop

Installed internet browsers include Sea Monkey, Opera, and Firefox.

Open Office is not installed on the basic version (it is included in the Deluxe edition). Instead you’ll have Gnumeric Spreadsheet, Abiword, and Calendar.

Multimedia includes the great VLC player, Mplayer, Xine, XMMS, and others.

Configure your system with the VASM Control Center.

Gallery of Screenshots

Continue reading “Vector Linux 6.0 Gold – Review and Screenshots”