Setting up virtual hosts with Apache

11 11 2008

Thought I should post about setting up virtual hosts in Apache, since this was one of the first things I had to do. I got all this info from this site, which was incredibly useful. For all the following instructions, when you see these instructions:

enter some/text/here

You need to enter this text exactly as you see it in your terminal, which can be found at Applications>Accessories>Terminal

First, you need to set up your folders where the sites are gonna be stored:

mkdir /home/www/www.example.com
mkdir /home/www/www.example.net

Then you need to tell Apache that you are gonna use virtual hosts. Create a file using:

sudo touch /etc/apache2/conf.d/virtual.conf

You need to add the following content, use:

sudo gedit /etc/apache2/conf.d/virtual.conf

and enter the following:

#
#  We're running multiple virtual hosts.
#
NameVirtualHost *

Now, you have to create an entry in both the sites-enabled and sites-available directories in /etc/apache2. So, first create the following file:

sudo touch /etc/apache2/sites-available/www.example.com

and enter the following by using:

sudo gedit /etc/apache2/sites-available/www.example.com

and enter:

#
#  Example.com (/etc/apache2/sites-available/www.example.com)
#
<VirtualHost *>
        ServerAdmin webmaster@example.com
        ServerName  www.example.com
        ServerAlias example.com

        # Indexes + Directory Root.
        DirectoryIndex index.html
        DocumentRoot /home/www/www.example.com/htdocs/

        # CGI Directory
        ScriptAlias /cgi-bin/ /home/www/www.example.com/cgi-bin/
        <Location /cgi-bin>
                Options +ExecCGI
        </Location>

        # Logfiles
        ErrorLog  /home/www/www.example.com/logs/error.log
        CustomLog /home/www/www.example.com/logs/access.log combined
</VirtualHost>

Next, do the same for your second site, so create a file using:

sudo touch /etc/apache2/sites-available/www.example.net

and enter the following by using:

sudo gedit /etc/apache2/sites-available/www.example.net

and enter:

#
#  Example.net (/etc/apache2/sites-available/www.example.net)
#
<VirtualHost *>
        ServerAdmin webmaster@example.net
        ServerName  www.example.net
        ServerAlias example.net

        # Indexes + Directory Root.
        DirectoryIndex index.html
        DocumentRoot /home/www/www.example.net/htdocs/

        # CGI Directory
        ScriptAlias /cgi-bin/ /home/www/www.example.net/cgi-bin/
        <Location /cgi-bin>
                Options +ExecCGI
        </Location>

        # Logfiles
        ErrorLog  /home/www/www.example.net/logs/error.log
        CustomLog /home/www/www.example.net/logs/access.log combined
</VirtualHost>

Finally, you need to create a copy of these files in the sites-enabled directory, using what is called a symbolic link. You can use a funky little program called a2ensite to do this. So, enter the following:

sudo a2ensite www.example.com
sudo a2ensite www.example.net

And finally (I was lying last time), you need to restart Apache for this to all take effect:

sudo /etc/init.d/apache2 reload

And tada, it should all be working, yay!





Setting up WordPress

11 11 2008

Formatting and Structure

One interesting thing I just noticed. When you write a page, and presumably a post, and WordPress creates a permalink for you, make sure you know what you want to call it, and don’t change it. It seems that wordpress uses the first title you choose as the permalink title. Even if you change the title later, it uses the original title as the permalink. Something to bear in mind when you get home late, drunk, and decide to write a rant about curbs and giving it a less than gregarious title…Ooh, I’ve just noticed you can edit it, in the permalink option beneath your page title..very cool.





Setting up Apache

11 11 2008

mod_rewrite

After getting Apache up and running in Ubuntu, I needed to make sure it was all configured for WordPress. Everything was ok, excpet for mod_rewrite, which I apparently needed to enable. After some googling googling, I realised I needed to do this:

First, I needed to add the rewrite.load to /etc/apache2/mods-enabled/
So, open a terminal window and type:
sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/

Second, edit the apache configuration for my virtualhosting. For example, in my computer I only have one virtual hosting (/var/www) that is default from installation, so I make some adjustment for that (In my case I have to edit this file /etc/apache2/sites-enabled/000-default)
Again in terminal type (this loads a text editor with the correct permission allowing you to edit the file:
sudo vi /etc/apache2/sites-enabled/000-default
Change the Allowoverride value to all for the document root directory
For example, I made change to this part of the configuration:

/var/www/
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
# Commented out for Ubuntu
#RedirectMatch ^/$ /apache2-default/

Finnaly, just restart the apache, so, again in terminal type:
sudo /etc/init.d/apache2 restart

.htaccess

I wanted to get WordPress to use nice page structures, rather than all that silly ?>443634 stuff. So, in settings in WordPress, I chose the permalink option and decided on the day,date,name option. However, for this to work, as wordpress warned me, I needed to allow wordpress to write to my .htaccess file.

The .htaccess is a file that can be used to do a lot to change the way your site works, it can be used to add security to your site (all though this isn’t always the best way). It turns out that my site didn’t have a .htaccess file, so I had to create one, this was as simple as creating an empty file in the root of my websites directoy and calling it, yes, you guessed it: .htaccess.

I then had ensure wordpress can write to this file. I did this temporarly (by typing sudo nautilus into terminal, which opens a file explorer, but as the super user, so you can do what you want (carefull, you can kill your system if you delete a file that is needed) and navigating to the root of my website directory and right clicking on the .htaccess file I created and choosing the permissions tab and changing the option so everyone can read/write the file and click OK). I then chose the correct option in wordpress via the admin interface to make fancy URLs. WordPress now no longer moans about not be able to write to the .htaccess file. Now, I go back to the .htaccess file in nautilus, right click it again and chase the permission for everyone back to read only. Ta da – fancy URLS and some security to boot.





So, how should you trackback

11 11 2008

I try to trackback to posts I am commenting on properly, but not all blogs offer a trackback URL, so I post a link to my post in the comments.

Seems like this pissed some one off, since they wrote a comment (ooh, my first!!) telling me to stop spamming! Not very helpful, since it didn’t say what I was spamming, but I guess it was my comments on other posts.

So, how are you meant to trackback when there are no trackbacks?

Turns out it was my attempt at trackbacking on the lifehacker site, that got a vitriolic response from some liefehacker readers. Ok, so, it was my bad for not writing an actual comment alongside my comment trackback, but still, give a blogger a break. After all, blogs live and die by trackbacks and linking to each other, that is all I was trying to do. Guess I wont bother in future. Jeesh, some people do love to troll. For future ref, refer to here when wanting to trackback.

It seems the best thing to do is, if there is no trackback link, then too bad. If there is a trackback link, then add that to the bottom of your page when blogging in wordpress (in the ‘write’ page). Remember of course, that wordpress automatically trackbacks to other wordpress blogs, so even if the blog doesn’t provide a trackback link, you might be in luck.

If you don’t follow these rules, then beware the internets’ wrath. For those I offended, sorry, naughty me, it wont happen again ;)





When will techies be satisfied

10 11 2008

So, as more Windows 7 news leaks out and people try out preview builds, the techie naval gazing continues. Windows 7 startup times get analysed, which really is a waste of time considering this is a preview pre-beta build, whilst more features are drooled over, or bashed, depending on your point of view. Meanwhile, as is always the case, people try and adopt the new features of the new OS, only to invariably bash it when it is released because it doesn’t place nice with the hardware they own that was designed before their fancy new OS was released. And there will be the moans that the system requirements are too high and the OS is really unresponsive compared to the last version – of course ignoring the fact that this is an OS designed to cope with hardware for the next five years.

navel gazing

navel gazing

And, as normal, reviews will concentrate on form, not function.





PSP awesomeness – Remote Play

9 11 2008

I have owned a Sony PlayStation Portable (PSP) for about two months now and I have to say, it is awesome. Graphics-wise, it is somewhere between a PlayStation and a PlayStation 2 – depending on the game. There is a fairly decent amount of games out there, but it is definitely passed over in favour of the Nintendo DS by game developers, so it certainly isn’t the lead mobile gaming platform. I think this is a great shame, since it is a much more able machine than the DS. In addition to it being a great gaming platform, it also is a media (music and video) player, internet browser (though the browser is limited and doesn’t support the latest version of flash), RSS feed reader and network services provider.

Remote Play

Remote Play

Network services provider? Well, basically, one of the PSP’s best functions is it’s ability to connect to the Playstation3 you own, called Remote Play ;) Providing your Playstation3 is connected to the internet and you are registered with the PlayStation Network then you can connect your PSP to your Playstation3 from anywhere in the world that you have access to a WiFi network. It can even turn your Playstation3 on, if it is on standby. This then opens you up to all the music and videos you have stored on your Playstation3, as well as allowing you to play any PSOne games you have on your Playstation3, via your PSP.

PlayTV

PlayTV

Things don’t stop there though. If you have PlayTV on your Playstation3 then you can connect to it via Remote Play and, TaDa, you’ve got TV on your PSP! You can do everything that you can normally do through PlayTV on your Playstation3 – watch live TV, pause TV, record TV, set recordings and watch recordings. To me this is such an awesome awesome bonus, I am amazed more isn’t made about it by the gaming people.

It is all terribly easy to set up:

  1. Connect your PSP to your Playstation3 via a USB cable.
  2. Activate the USB connection on your PSP.
  3. Go to Settings > Remote Play on your Playstation3.
  4. Add your PSP as a registered device on your Playstation3.
  5. Disconnect your PSP from your Playstation3.
  6. Go to Remote Play on your PSP’s Network menu.
  7. TaDa.




How to loose customers and aggravate people

6 11 2008

For the last few days I fell into the hellish world that is Creative Technology and their sound cards.

Even just doing a cursory search you find the pain that this company has put its customers through, namely bad drivers, updated drivers removing features original included in the product and shutting down attempts to rectify failures in their drivers.

Such horror stories include:

  • failing to release drivers for Vista until 6 months or so after the release of Vista. Then when a user creates their own, fully Vista-compliant drivers before Creative do, they pile on loads of pressure and force the guy to stop development,
  • releasing updated drivers to their sound card range that actually removes Dolby and DTS decoding, after advertising it as a feature of the original card,
  • having various varients (via S/N) of the same product that have different features turned on and off, leaving it down to a S/N lottery for the user and never telling them.

So, after toying with the idea of updating my soundcard to be able to decode my PS3′s optical output, I realised the error of my ways and went for this excellent surround sound speaker setup that includes digital decoding built in.

Nice one Creative. I am sure their products are fine for the average user, but for anyone who is expecting anything more than average use might find they run into a whole heap of pain.





Little Big Planet

4 11 2008

I know there are many many many sites, posts and stories about this game, but hey.

Little Big Planet (LBP) is Sony’s lead title for Playstation 3 at the moment and it comes highly praised by many industry experts. You play the character of Sack Boy – a loveable toy person, that you can dress up and modify in many different ways, just like his little room he lives in. LBP’s single player mode is part 2.5D platformer, full of lovely little levels where you collect stickers, items and tools that you can use to decorate your room. It is these items and tools that then go towards the main part of the game, building your own levels. This is the real fun of LBP, you can create your own levels and then share them with other players and friends. People who see LBP as just a platformer are only seeing a very small part of the game. It is the ability to create and share levels which is the real draw and is no-doubt going to lead to loads of amazing creations.

LBP

LBP

I’ve only played it for about half an hour, but already I have fallen in love with it. The addition of tutorials from Stephen Fry only add to the cuteness. Truly awesome stuff. Lets just hope the fun lasts.





Simple backups in Ubuntu

3 11 2008

So, I was trying to find a decent way to carry out backups on my Ubuntu server. After trying and failing with many many different packages available from the Ubuntu repositories (keep, sbackup, backuppc) I came across rsback.

Rsback uses the highly recommended program rsync to make backups. It is basically a script for rsync that you need to add certain configurations to, to set up different backup jobs. It is set up in such a way as to perform incremental backups that occur daily and weekly – ensuring you always have a nice historical record of your files.

After messing around with so many other options, I found it the best option and highly recommend it. You need to get down and dirty with a text file configuration, but that is the norm with Ubuntu.

There are ofcourse many Windows options out there.

rsback





An excellent free multiplayer game

3 11 2008

There are many great games out there for both PC and console, but there aren’t as many great free ones. This was all changed with the release of Wolfenstein: Enemy Territory; commonly referred to as ET. ET is a WWII-themed multiplayer first person shooter (FPS). There is no single-player mode, but this is no bad thing, since the multiplayer mode is truly exceptional.

ET screenie

ET screenie

You join either the axis or the allies, and then choose a class: either Soldier, Medic, Engineer, Field Ops or Covert Ops. Each class has certain unique abilities (Soldiers can use extra-powerful weapons, Medics can revive and heal, Engineers can destroy and repair objectives, Field Ops can call airstrikes and give ammo and Covert Ops can disguise themselves as the enemy). Each map typically has an objective that has to be completed by one of the teams, or sometimes each team has an objective to complete.

ET screenie

ET screenie

All the game servers are hosted by clans or individuals, meaning they often come with a ready-made community. Despite the game being released in 2003, it is still very popular and has a cult following amongst its regular players.

I play only on one server, those provided by the Buffalo Bad Ass (BBA) clan (of which I am a member). They are generally ranked number one amongst all the ET servers, and are known for having a good friendly bunch of players on.

If you like FPS and multiplayer games, I highly recommend you get your hands on this excellent free game. Head on over to the BBA forums if you need any help to get started, and don’t be put off if you get killed a lot when you first start. We were all noobs once.

The first link below gives you a download for the original installer, it is then worth installing the two additional patches that are also linked.

ET download
Update 1
Update 2








Follow

Get every new post delivered to your Inbox.