Setup Multiple Sites Without a static IP

Site Admin
Posts: 1
Joined: Sun Apr 14, 2013 3:19 pm

Setup Multiple Sites Without a static IP

Postby boosargant » Thu Apr 25, 2013 11:18 am

this is mirrored from

his site seems to be down a lot so thought post it here.

credit goes to james.

In this tutorial I will hopefully teach you how to setup your pi as a LAMP server and host multiple sites.

Brief Overview/what will be covered:

This forum and website is hosted from my home on my raspberry pi, I do not have a static ip address as my ISP (TalkTalk) will not provide them.

You have no static ip? How am I here? - Its called Dynamic Dns. I use NO-IP, this is running on my router however it is possible to install this onto your Raspberry Pi if your router does not support it. :)

How do I get a website address? (domain name) E.G - You buy one, there are hundreds of providers! CrazyDomains seem to be the cheapest. Google them for more information.

How do I point the domain to my Raspberry Pi? - You use a DNS server, for this site I have used Hurricane Electric's free DNS hosting and have pointed the sites to the Dynamic Dns hostname Using CNAME records.

How does my Raspberry Pi understand what site it should show when I go to if I am hosting multiple sites? - Its called a virtual host, I won't go into much detail here as things get even more confusing! Google is your friend if you need more information.

Does wordpress run on a raspberry pi? - Yes, but not very well. The database requests are very CPU insensitive, you may have realized that the forum is much faster than the actual site. This proves this.

Ok now I have covered a few points lets continue to get this setup!

Installing LAMP:

LAMP is a combination of free, open source software. The acronym LAMP refers to the first letters of Linux, Apache HTTP Server, MySQL (database software), and PHP, Perl or Python - The necessarily software to run a fully functional webserver.

Please note this whole tutorial is based of the fact that you are running a Debian based distro.

Run the following to install LAMP:

Update your packages

apt-get update

Install apache

apt-get install apache2

Install PHP

apt-get install php5 libapache2-mod-php5

Install MySql

apt-get install mysql-server mysql-client php5-mysql

Restart the apache service

/etc/init.d/apache2 restart

If you got no errors that's LAMP installed!

Now you need a way to point your domains to your pi.

Setup no-ip:
Skip this if there is an option on your router for dyndns.

1) Sign up here:
2) Create a host
3) on your raspberry pi run the following:

mkdir noip && cd noip . && wget

4) Compile NO-IP

make && make install

5) add your login details when it asks you for them.
6) Make NO-IP run at startup

echo '/usr/local/bin/noip2' >> /etc/rc.local

Have an issue? There's a more detailed guide here … lient.html

DNS Server:
Presuming you already have your domain you can continue to setup a DNS server.

I have found that the Hurricane Electric DNS server is best for the job! Sign up here:

Once you have signed up click add domain and type your domain name E.G.

1) Login to your domain control panel E.G CrazyDomains and look for nameservers. Add the following:

2) Go back to your Hurricane Electric control panel and click "NEW CNAME" add one for www > and one for @ >
Replacing with the NO-IP hostname you setup earlier.

Repeat this for the domains you will be hosting (only if you are hosting multiple sites)

within 10 minutes - 24 hours the DNS will propagate across the internet. You can see if this has worked by visiting your domain. when it is working you should be greeted by:


This is the default web page for this server.

The web server software is running but no content has been added, yet."

your webserver is now setup! If you only plan on hosting one website you can now add your content to /var/www

If you plan on hosting multiple sites continue to follow this guide.

Now we will setup the virtual hosts.

We need to make a few directories to store the sites you will be hosting

mkdir /home/www

Replace, etc with your domain names.

1st Domain

mkdir /home/www/


2nd Domain

mkdir /home/www/


Now its time to configure Vhosts.

Virtual Hosts:

First we need to Enable Virtual Hosts:

touch /etc/apache2/conf.d/virtual.conf

nano /etc/apache2/conf.d/virtual.conf

Then add the following:

# We're running multiple virtual hosts.
NameVirtualHost *

Once this is done we need to make the individual host configuration files.

1) Make the following files replacing with your domain name. You need to create one of these config files for each domain that you will be hosting.

touch /etc/apache2/sites-available/ && nano /etc/apache2/sites-available/

You then need to edit the config file. Here is the one this site uses as an example:

<VirtualHost *>

# Indexes + Directory Root.
DirectoryIndex index.php
DocumentRoot /home/www/

# CGI Directory
ScriptAlias /cgi-bin/ /home/www/
<Location /cgi-bin>
Options +ExecCGI

Repeat step one for each site you will be hosting.

To enable these sites now run


Once you have done this for the multiple sites that you will be hosting type

/etc/init.d/apache2 reload

You can now add content to your domains in /home/www/

I understand this is a very confusing guide. If it doesn't help you or you don't understand it then you probably shouldn't be reading it

Return to Server's

Who is online

Users browsing this forum: No registered users and 1 guest