Installation and management of Apache

First things first - before starting the operation it is necessary to update in order to get the latest versions of packages. Use the command  sudo apt-get update 
After this you can now install Apache2. Write  sudo apt-get install apache2  on to your terminal, except installation terms with Y and enter and you are ready to go.

 sudo a2enmod userdir  basically changes the location folder to user's directory, making it easier to control while all your important files stay in a one and same place. Now Terminal will ask you to restart the server and make sure you will execute it properly. 

Go to your home direction (e.g. /home/xubuntu/ Remember! if you are not sure about your identity you can always ask it by writing  whoami ).

Create a new folder  mkdir public_html  and enter. In my case I wanted to make a test file to see if my server is working. 

After saving I navigated myself into the front page. You can use your PC's IP address ( can be found with ifconfig ) and write it to a browser's URL bar (or simply type localhost).

Success! My test file appeared to localhost/~xubuntu/test so it's time to write a real HTML5-page. If you wan't your webpage to open straight in localhost/xubuntu the file name has to be index.html 

<!doctype html> Tells that this document's type is html.
<html></html> The root of html document. All your codes go inside these tags.
<head></head> Contains the information of the document (e.g. <title></title>)
<body></body> Document's body.

The final look of my webpage with the false link.

Reading the errors and user actions

Installing Apache2 didn't go as smoothly as you might think by reading this document. My first error came from very beginning after changing the directory of Apache. This is the part when I am asked to run the restart of the server (service apache2 restart).

Visiting the log doesn't really give any clues but observing the execution command enlighten my thoughts - 87: ulimit: error setting limit (operation not permitted) tells that I don't have enough authenticity to run this command. The error fixed simply by adding sudo in front of the line (sudo service apache2 restart).

Thankfully the second error was premeditated. It appeared when the user tried to get free candy from my "false link page".

Here we can see that the user visited the webpage exactly 19/Sep/2013:15:28~ and tried to click the false link to /localhost/~xubuntu/freecandy but the session ended to error 404, meaning the page wasn't found.

Linux version: Xubuntu 12.04, 64-bit

System information - OS: Windows 8 64bit Manufacturer: Dell Inc.Model: Inspiron 3721 BIOS: A05 Processor: Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz (4 CPUs), ~~1,8GHz Memory: 8192MB RAM

Based on Linux course by Tero Karvinen (


Popular Posts