Ubuntu (Hardy): Install Apache 2 Server

Setting up Apache 2 server on Ubuntu Hardy is pretty easy.

sudo aptitude install apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert

Note:

I choose apache2-mpm-prefork (single thread) over apache2-mpm-worker (multi-threaded requests). This is because mod_rails may work with apache2-mpm-worker, but is only currently tested to work with apache2-mpm-prefork.

ServerName

Edit your apache configuration file:

$ vim /etc/apache2/apache2.conf

At the end of the file add the following:

ServerName your_server_name

And restart your server:

$ sudo apache2ctl graceful

Note:

If you get the following error when restarting Apache it means that you didn’t succeed in setting the ServerName:

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

Test

Start your prefered browser and open your server ip address (e.g. http://127.0.0.1), you should see something like this:

It Works!

Or use curl (command line is always better):

$ curl http://127.0.0.1

You should see:

<html><body><h1>It works!</h1></body></html>

It Works!!!

Ubuntu (Hardy): Install Apache 2 Server