Setting Up Your Ubuntu 8.10 VPS with VPS Ville Pt. 3 Virtual Hosts, Other Odds and Ends

Sunday, March 1, 2009 16:38
Posted in category Uncategorized

12. Virtual Hosts

Now that we have everything up and running, there’s just some last minute work to be done so that we can easily just upload stuff via FTP and not have to move it to the /var/www (which you can’t move files too without sudo).  First make sure you are in your home directory:

cd ~

Then we create a directory for our web files.

mkdir www

Lets also quickly make a simple html file, so we can tell that the changes have taken effect.

cd www

nano index.htm

Past this into the file:

<html><body><h1>Home WWW!</h1></body></html>

Ctrl + O, then Enter to save.  Ctrl + X to exit.

Now lets open our virtual host file:

sudo nano /etc/apache2/sites-enabled/000-default

The top part of it ought to look like this:

<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

Where you see “/var/www/”  Change it to “/home/username/www“. This is an incredibly simplistic virtual hosts file.  As of right now all it does is brings all traffic, regardless of IP address it’s directed at, or domain and sub-domain.  I’m sure I’ll write a virtual hosts guild later down the road.

Restart Apache:

sudo /etc/init.d/apache2 restart

Now you should be able to naviate to your servers ip or domain name yet set up and instead of it saying “It Works!” it should say “Home WWW!”.

From not on just upload all your files to the /home/username/www directory.

13. Unattended Upgrades

Because you may not want to log in every single day and run updates just install the unattended-upgrades package:

sudo apt-get install unattended-upgrades

Not every single package can be upgraded without user interaction, you may want to log in at least every couple of days and run apt-get update and apt-get upgrade just to make sure.

14.  Keep server time up to date

sudo apt-get install ntp ntpdate

Your system should stay up to date and time.

15. Webalizer

For traffic stats and the such:

sudo apt-get install webalizer

Conclusion

You know have a working server environment.  There’s more you could do, like install Bind9 if you want to host your own DNS rather than use someone elses.  You could install a free control panel like ISPconfig.  Take time, do some reasearch have fun!

You can leave a response, or trackback from your own site.
Hotmail


Leave a Reply