NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
devbobo
Nov 29, 2009Aspirant
HOW TO: Hosting multiple websites
G'day Guys, For some time I've wanted to host multiple websites from a single ReadyNAS unit...I haven't had the time to investigate it. 1. Backup all the .conf files in /etc/frontview/apache 2....
WhoCares_
Nov 30, 2009Mentor
dbott67 wrote: Nice how-to... thanks for sharing.
Does this still require these steps?
http://www.readynas.com/?p=135
No, actually the approach from this Howto is more flexible but requires more work and a lot more knowledge about how things "really work".
dbott67 wrote: Currently, I've got my blog-thingy hosted on the ReadyNAS Pro. In Frontview, under the HTTP protocol I am redirecting HTTP traffic to the read-only HTTP share "webserver". How does your how-to fit in with this?
Two totally different beasts.
The way you do it will create a config similar to this:
<VirtualHost _default_:80>
SSLEngine off
RewriteEngine on
RewriteRule ^/$ /website [R,L]
RewriteRule ^/admin/(.*)$ https://%{SERVER_NAME}/admin/$1 [R,L]
</VirtualHost>
The important part is line 4 where all requests are redirected to the Share "website". That's what you already noticed here:
dbott67 wrote: Notice that when you try to go to my site http://home.bott.ca/ in automatically redirects to the webserver share (as I expect it would - http://home.bott.ca/webserver/).
While this works, it will just allow you to host one website on your NAS.
Comes in the Howto. The important part here is that you can have not only one but several <VirtualHost ...> entries.
This leads straight to your next question:
dbott67 wrote: Do all websites have to be placed within this "webserver" share?
No. Let's have a look at the VirtualHost definition:
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /path/to/example.com
<Directory /path/to/example.com>
Options Indexes
Order allow,deny
Allow from all
</Directory>
<Location /index.html>
SetHandler none
Order Allow,Deny
Allow from all
</Location>
SSLEngine off
</VirtualHost>
Notice line 3. The DocumentRoot ... tells Apache where to look for the files it should serve to the user. In this case this would be /path/to/example.com
Also important is line 2. The ServerName ... tells Apache what site this configuration is meant for.
A simple, yet very abbreviated example:
<VirtualHost *:80>
ServerName server1.dyndns.org
DocumentRoot /website1
(...)
</VirtualHost>
<VirtualHost *:80>
ServerName anotherserver.dyndns.org
DocumentRoot /website2
(...)
</VirtualHost>
Now what happens when a request comes in is this: Apache will look in the headers for the host name the user wanted to address. Say the user requested "anotherserver.dyndns,org". Apache finds the defintion for that server, looks into the directory /website2 and will serve the file index.html if it's to be found there. (That's an overly simplistic explanation but you should get the drift). /website2 doesn't have to be a share, it just has to exist.
Likewise, since all Apache cares about is the host name, not the IP address, "server1.dyndns.org" and "anotherserver.dyndns.org" may of course point to the same (your public) IP address.
I really hope this was somewhat understandable since I tried to cramp many things in a "not too long to digest" post ;)
-Stefan
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!