<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>http://vwiki.co.uk/index.php?action=history&amp;feed=atom&amp;title=Multiple_Websites_On_The_Same_Server</id>
	<title>Multiple Websites On The Same Server - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://vwiki.co.uk/index.php?action=history&amp;feed=atom&amp;title=Multiple_Websites_On_The_Same_Server"/>
	<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Multiple_Websites_On_The_Same_Server&amp;action=history"/>
	<updated>2026-04-19T06:46:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Multiple_Websites_On_The_Same_Server&amp;diff=2096&amp;oldid=prev</id>
		<title>Sstrutt: Added link to Secure_Website and Meta</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Multiple_Websites_On_The_Same_Server&amp;diff=2096&amp;oldid=prev"/>
		<updated>2012-08-07T07:09:11Z</updated>

		<summary type="html">&lt;p&gt;Added link to Secure_Website and Meta&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 07:09, 7 August 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;There are various methods that can be used to enable you to host multiple websites on the same server.  This is but one, and allows you to host different domains on the same server.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;There are various methods that can be used to enable you to host multiple websites on the same server.  This is but one, and allows you to host different domains on the same server.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You&#039;ll need a publicly accessible server running Apache, and the ability to create DNS entries for the domains you want to host.  In this example we&#039;re creating two websites, called &#039;&#039;web1&#039;&#039; and &#039;&#039;web2&#039;&#039;, on a server with IP address &#039;&#039;123.10.10.2&#039;&#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You&#039;ll need a publicly accessible server running Apache, and the ability to create &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Acronyms#D|&lt;/ins&gt;DNS&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]] &lt;/ins&gt;entries for the domains you want to host.  In this example we&#039;re creating two websites, called &#039;&#039;web1&#039;&#039; and &#039;&#039;web2&#039;&#039;, on a server with IP address &#039;&#039;123.10.10.2&#039;&#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;If you want one (or more) of your sites to be secure (accessible via [[Acronyms#H|HTTPS]]), then also see the [[Secure Website]] page.  Though you&#039;re recommended to get multiple sites working 1st, and the attempt to add security.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== DNS ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== DNS ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Multiple_Websites_On_The_Same_Server&amp;diff=1705&amp;oldid=prev</id>
		<title>Sstrutt: Initial creation - content from Apache page</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Multiple_Websites_On_The_Same_Server&amp;diff=1705&amp;oldid=prev"/>
		<updated>2012-02-09T10:40:23Z</updated>

		<summary type="html">&lt;p&gt;Initial creation - content from Apache page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;There are various methods that can be used to enable you to host multiple websites on the same server.  This is but one, and allows you to host different domains on the same server.&lt;br /&gt;
&lt;br /&gt;
You&amp;#039;ll need a publicly accessible server running Apache, and the ability to create DNS entries for the domains you want to host.  In this example we&amp;#039;re creating two websites, called &amp;#039;&amp;#039;web1&amp;#039;&amp;#039; and &amp;#039;&amp;#039;web2&amp;#039;&amp;#039;, on a server with IP address &amp;#039;&amp;#039;123.10.10.2&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== DNS ==&lt;br /&gt;
Before you configure the webserver, you need to set-up DNS correctly, for this example this could be done in one of two ways...&lt;br /&gt;
* A records only&lt;br /&gt;
** &amp;lt;code&amp;gt; web1.domain.com -- A record --&amp;gt; 123.10.10.2&amp;lt;/code&amp;gt; &lt;br /&gt;
** &amp;lt;code&amp;gt; web2.domain.com -- A record --&amp;gt; 123.10.10.2&amp;lt;/code&amp;gt; &lt;br /&gt;
* A and CNAME records&lt;br /&gt;
** &amp;lt;code&amp;gt; web.domain.com -- A record --&amp;gt; 123.10.10.2&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt; web1.domain.com -- CNAME record --&amp;gt; web.domain.com&amp;lt;/code&amp;gt; &lt;br /&gt;
** &amp;lt;code&amp;gt; web2.domain.com -- CNAME record --&amp;gt; web.domain.com&amp;lt;/code&amp;gt;&lt;br /&gt;
...how you choose to do it is up to you, and depends on what changes you might expect to make down the line.  If you have a small set-up its probably easiest to go with purely A-records, but where you have a larger number of websites and web-hosts, it can be easier to manage with all your web-hosts having A-records and all web-sites having CNAME-records pointing to the host that they&amp;#039;re running from.&lt;br /&gt;
&lt;br /&gt;
Either way, you should be able to ping the addresses of either website and get the correct IP address back.&lt;br /&gt;
&lt;br /&gt;
== Web Server Configuration ==&lt;br /&gt;
Now you should check that you web server is working correctly.  If its a new install, you should be able to browse to the server&amp;#039;s IP address and get a basic &amp;quot;It works!&amp;quot; page back.  This site, or any site that&amp;#039;s using the root of your web-server will need to be (re)moved.&lt;br /&gt;
&lt;br /&gt;
Now to create the web-sites...&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;If you have an existing site that&amp;#039;s served from the root of your webserver, this needs to be removed 1st.&amp;#039;&amp;#039;&amp;#039; So to remove the default site that&amp;#039;s installed with Apache...&lt;br /&gt;
## Disable the web-site by removing the link to its config from &amp;lt;code&amp;gt;sites-enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt; rm /etc/apache2/sites-enabled/000-default&amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt; service apache2 restart&amp;lt;/code&amp;gt; (you may get a warning about &amp;#039;&amp;#039;no VirtualHosts&amp;#039;&amp;#039;)&lt;br /&gt;
## Test by browsing to your web-server&amp;#039;s IP address, no webpage should be returned&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;Now create the required folders...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
## Create sub-folders for your web-sites, eg&lt;br /&gt;
##* &amp;lt;code&amp;gt; mkdir /var/www/web1.domain.com &amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt; mkdir /var/www/web2.domain.com &amp;lt;/code&amp;gt;&lt;br /&gt;
## Create sub-folders for your web-sites&amp;#039; logs, eg&lt;br /&gt;
##* &amp;lt;code&amp;gt; mkdir /var/log/apache2/web1.domain.com &amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt; mkdir /var/log/apache2/web2.domain.com &amp;lt;/code&amp;gt;&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;Now create the required configs...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
## Create a config for web1, using the example file contents below&lt;br /&gt;
##* &amp;lt;code&amp;gt; vi /etc/apache2/sites-available/web1.domain.com &amp;lt;/code&amp;gt;&lt;br /&gt;
## Create a config for web2, using the example file contents below, but edit so that web1 becomes web2&lt;br /&gt;
##* &amp;lt;code&amp;gt; vi /etc/apache2/sites-available/web2.domain.com &amp;lt;/code&amp;gt;&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;Now create some test content, and enable...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
## Copy the default index.html to your new web-site folders, and edit so that they identify the web-site they&amp;#039;re in&lt;br /&gt;
##* &amp;lt;code&amp;gt; cp /var/www/index.html /var/www/web1.domain.com/ &amp;lt;/code&amp;gt; and edit&lt;br /&gt;
##* &amp;lt;code&amp;gt; cp /var/www/index.html /var/www/web2.domain.com/ &amp;lt;/code&amp;gt; and edit&lt;br /&gt;
## Enable the websites&lt;br /&gt;
##* &amp;lt;code&amp;gt; cd /etc/apache2/sites-enabled &amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt; ln -s ../sites-available/web1.domain.com web1.domain.com&amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt; ln -s ../sites-available/web2.domain.com web2.domain.com&amp;lt;/code&amp;gt;&lt;br /&gt;
## Restart the Apache service to apply&lt;br /&gt;
##* &amp;lt;code&amp;gt; service apache2 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;Test - you should now have two separately accessible websites..!&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin info@domain.com&lt;br /&gt;
        ServerName  web1.domain.com&lt;br /&gt;
 &lt;br /&gt;
        # Indexes + Directory Root.&lt;br /&gt;
        DirectoryIndex index.php&lt;br /&gt;
        DocumentRoot /var/www/web1.domain.com/&lt;br /&gt;
 &lt;br /&gt;
        &amp;lt;Directory /&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
        # Logfiles&lt;br /&gt;
        ErrorLog  /var/log/apache2/web1.domain.com/error.log&lt;br /&gt;
        CustomLog /var/log/apache2/web1.domain.com/access.log combined&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;/VirtualHost&lt;br /&gt;
&lt;br /&gt;
[[Category:Apache]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
</feed>