Skip to main content

Configuring settings for Apache2 virtual server

In this post I will show how to configure the basic settings for apache2 based virtual server and guide a website to appear in the desired address in local computer.

Setting up Apache


sudo apt-get update I ran the update.
sudo apt-get install apache2 Installed Apache.

sudo a2enmod userdir
Enabled userdir

sudo service apache2 restart
and restarted the module.

I tested the functionality by writing "localhost" on my address bar and got "it works!"-page.

 

Creating a webpage


mkdir public_html
mkdir carolwenn.com
nano index.html


I created public_html on my home directory, entered and added a new folder for my virtual server (carolwenn.com). Finally I made my index.html page with the following code:

<!doctype html>
<html>
<head>
              <title>carolwenn.com</title>
              <meta charset="utf-8" />
</head>
<body>
               <h1>Carola's homepage</h1>
               <p>Welcome to carolwenn.com</p>
</body>
</html>

 

Settings


ifconfig
I needed to find out my own ip address so I could get the website to appear where I wanted to. After copying it I changed the directory to hosts and modied the file by adding the ip and my own desired address.
/etc/hosts/
nano hosts


192.168.***.*** www.carolwenn.com
192.168.***.*** carolwenn.com


Everything good so far but this wouldn't be enough. In order carolwenn.com to work I would have to enable it from apache's settings.

cd /etc/apache2/sites-available/
sudo cp 000-default.conf carolwenn.com


I copied my carolwenn.com as the default-file (000-default.conf) and replaced contents with configurin server name, alias and giving the address to the root file as shown:
<VirtualHost *:80>
     ServerName www.carolwenn.com
     ServerAlias carolwenn.com
     DocumentRoot /home/xubuntu/public_html/carolwenn.com
</VirtualHost>



sudo a2ensite carolwenn.com

When trying to enable my site (actually making it appear in carolwenn.com) I faced an error that claimed my site did not even exist. a2ensite is actionally a  perl script which only work with files ending with .conf. I changed my original file name from carolwenn.com to carolwenn.com.conf and tried again.
 

sudo mv /etc/apache2/sites-available/carolwenn.com /etc/apache2/sites-available/carolwenn.com.conf

 The Result


sudo a2ensite carolwenn.com

The second time running a2ensite was succesful and my address appeared to both carolwenn.com and www.carolwenn.com






Sources 
Lectures by Tero Karvinen
https://viivijarvela.wordpress.com/2014/03/10/apache-ja-virtuaalipalvelin/
https://eliimatt.wordpress.com/2012/09/24/harjoitustehtava-5-apache/
http://stackoverflow.com/questions/20591889/site-does-not-exist-error-for-a2ensite
http://manpages.ubuntu.com/manpages/jaunty/man8/a2ensite.8.html
Based on Linux course by Tero Karvinen (http://terokarvinen.com)

Comments

Popular posts from this blog

Building Love-O-Meter by using a temperature sensor

This "Love-O-Meter" is based on the tutorial by Arduino and it comes with the starter kit. It uses a temperature sensor to measure the warmth of your skin and then starts to turn on (or off) the LEDs  indicated by the temperature.

The components Arduino UNOBreadboardJumper wiresLEDs220 ohm resistorsTMP36 temperature sensor

Building the Circuit
At first I ran the "Hello World" for Arduino to make sure the environment would work as expected. Now I could start to connect the jumper wires between Arduino UNO and the breadboard.

As usually I connected the breadboard to power (5V) and to the ground (GND). I inserted the TMP36 on the breadboard so the rounded part of the sensor would face away from Arduino.

I attached 3 LED lights and the resistors and connected them with Arduino. The lights should react to the heat of the finger and if the temperature would get hot enough all the lights would be on and would also tell you if you are a hot lover or not...

The result and the …

Creating a Bootable USB for Kali Linux

If you are interested to see my documentation about making a bootable USB for Xubuntu please click here!

This USB was made by using the latest version of Xubuntu (the 14.04 release).

Downloading Kali Linux 
23.13. After navigating to https://www.kali.org/ I chose the version that would suit me the best and started downloading the ISO image for 64-Bit system.


USB imaging
22.40. I followed the guide offered by kali.org and used the commandsudo fdisk -lwithout plugging the USB yet. I needed to pay attention to the path of Device Boot (/dev/sdb1). After this I inserted USB and ran the same command again. Now I could see how the name of Device Boot had changed to sdc1. This would be my USB to use.

22.50 It only took a while to format the dd code correctly as the base was already given on Kali's web page. After running the correct command for the first time I got an error message "'/dev/sdc1': Permission denied". In these kind of situations I tend to ask sudo for help an…

Using a button to control the LED light

This time my project was to configure how to build a button that would turn on and off depending if the user is pushing it or not. While holding the button down the LED should stay on until removing the finger.



For this assignment I used the fallowing components:
Arduino UNO and USBJumper wiresLED lightBreadboardButton10k ohm resistor
At first I run the "Hello World" for Arduino and made sure that the LED I was using worked properly (read my previous post).

I attached the button in the middle of the breadboard so the legs were touching the both "sides" of it.


Now I started to connect the jumper wires between the Arduino UNO and the breadboard. In order to get it working like in the sample code (Ardoino > Examples > 02.Digital > Button)
I linked the wires with Arduino's 5V (red wire, positive) and ground (black wire, negative) to the equal holes on the very corner of the breadboard (+ and -). I put the white jumper wire to connect the positive circuit to t…