AndyHat Consulting

Setting up a web folder

Setting up a web folder

This tutorial follows on from the setting up a development server tutorial and we ill be making a folder to contain our websites. Steps 1 and 2 are required while steps 3 and 4 are only required if using a linked folder like in the installing XAMPP on Unbuntu tutorial. The use of virtual servers will be covered in the next tutorial.

Step 1 Creating the folder

Open the terminal from the launcher or by pressing Ctrl-Alt-t. To create a websites folder in your home folder by typing the following in the terminal.

mkdir websites

 Step 2 Change the permissions

During the setup of the web-server a new user /group that is used by the webserver. So that the webserver can use and run code from our new websites folder we need to change the permissions on the websites folder so the Apache servers group becomes the owner. By default the Apache server creates an uses the www-data group.

To change the folder permissions so that the www-data group has ownership of the websites folder you need to type the following in the terminal

sudo chown -R :www-data websites/

If asked for the root password please enter your password.

 Step 3 Creating a link to the folder (Optional)

There are 2 ways to run the development webserver. The first uses sub folders of your localhost the second uses Apache virtual hosts.

For this step we are creating a symbolic link to our new websites folder from /var/www. Please type the following commands in the terminal.

cd /var/www
sudo ln -s /home/[username]/public_html ./[username]

A good description of the difference between symbolic links and hard links

Step 4 Creating a Test Page (Optional)

Place a test web page called index.html in the new websites folder

In your favorite editor enter the following text and save it a index.html in the websites folder.

<html><body><h1>Well done!</h1>
<p>This is web page in your websites folder.</p>

Now in your web brower’s address bar type:


You should now see the friendly “Well Done!” message.

What next?

The next tutorial will cover setting up virtual servers in Apache and using the hosts file to re-direct addresses.

If you like this article please subscribe to my RSS feed or share on one of these solcial networking websites.