Installing Apache and getting logs

Installing Apache and getting logs

9.9.2018 11.20

Setup: Ryzen 1600, Gtx 1060, Xubuntu 18.04

First run

$ sudo apt update && sudo apt upgrade


$ sudo apt install apache2

After that write “localhost” in your web browser

Lets make a website that the user can edit. First we need to make a directory “public_html” in your home folder.

$ mkdir public_html

Then we grab a bootstrap skeleton for our website copy paste the starter templateto your public_html directory nano file in

$ nano index.php

you can not see anything in your browser yet. You need to activate user public_html in apache2 first. with

$ sudo a2enmod userdir

restart of apache is needed with

$ sudo service apache2 restart

Tadaa! Your website is up

Getting some logs

lets try to get some logs in the var/log/apache2   Tail the error.log

$ tail -F access.log

write something random after your normal website for example

And you will get an error log   404 means “Not Found”  503 is “Service Unavailable”

A code 200 “OK” you get easily with just opening your own website.   I don’t know what that 1492 means.

Simple PHP form

Let’s copy the form from

to your index.php with

$ nano index.php

Then copy the

in to a new php file called action.php

$ sudo nano action.php

It will ask your name and age and tell them back to you. Pretty simple right?

Changing the DocumentRoot

9.9.2018 18.23 

Edit the 000-default.config file with

$ sudo nano /etc/apache2/sites-available/000-default.config

Change he DocumentRoot to your liking. and restart the apache service

$ sudo service apache2 restart

Now your localhost points to your home public_html


http status codes

bootsrap skeleton

PHP form

apache restart