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. Backup all the .conf files in /etc/frontview/apache - so you can restore the originals if you screw something up !!!
3. Edit /etc/frontview/apache/Virtual.conf
Original file
Modified file
4. Create a new my-virtual.conf file in /etc/frontview/apache/addons, this way it will be auto loaded without modifying any other files. The example below has definitions for two websites....add/remove as required.
my-virtual.conf
5. shutdown apache, killall apache-ssl
6. restart apache, apache-ssl -f /etc/frontview/apache/httpd.conf
7. All done :D
CAVEATS
1. Toggling the state of HTTP within Frontview rewrites Virtual.conf so the above changes will be lost.
ReadyNAS Team
1. It would be nice if the above changes could be made to the format of /etc/frontview/apache/Virtual.conf, so that changes aren't overwritten
2. I currently have to add the Location element to undo a global definition within httpd.conf. It would be awesome if this was removed from httpd.conf and added to Virtual.conf as...
Cheers,
David
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. Backup all the .conf files in /etc/frontview/apache - so you can restore the originals if you screw something up !!!
3. Edit /etc/frontview/apache/Virtual.conf
Original file
<VirtualHost _default_:80>
SSLEngine off
RewriteEngine on
RewriteRule ^/admin/(.*)$ https://%{SERVER_NAME}/admin/$1 [R,L]
</VirtualHost>
Modified file
NameVirtualHost *:80
<VirtualHost *:80>
SSLEngine off
RewriteEngine on
RewriteRule ^/admin/(.*)$ https://%{SERVER_NAME}/admin/$1 [R,L]
</VirtualHost>
4. Create a new my-virtual.conf file in /etc/frontview/apache/addons, this way it will be auto loaded without modifying any other files. The example below has definitions for two websites....add/remove as required.
my-virtual.conf
<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>
<VirtualHost *:80>
ServerName www.domain.net
DocumentRoot /path/to/domain.net
<Directory /path/to/domain.net>
Options Indexes
Order allow,deny
Allow from all
</Directory>
<Location /index.html>
SetHandler none
Order Allow,Deny
Allow from all
</Location>
SSLEngine off
</VirtualHost>
5. shutdown apache, killall apache-ssl
6. restart apache, apache-ssl -f /etc/frontview/apache/httpd.conf
7. All done :D
CAVEATS
1. Toggling the state of HTTP within Frontview rewrites Virtual.conf so the above changes will be lost.
ReadyNAS Team
1. It would be nice if the above changes could be made to the format of /etc/frontview/apache/Virtual.conf, so that changes aren't overwritten
2. I currently have to add the Location element to undo a global definition within httpd.conf. It would be awesome if this was removed from httpd.conf and added to Virtual.conf as...
NameVirtualHost *:80
<VirtualHost *:80>
<Location /index.html>
SetHandler server-status
Order Deny,Allow
Deny from all
</Location>
SSLEngine off
RewriteEngine on
RewriteRule ^/admin/(.*)$ https://%{SERVER_NAME}/admin/$1 [R,L]
</VirtualHost>
Cheers,
David
129 Replies
Replies have been turned off for this discussion
- Event_HorizonAspirantI've been playing around with this for a few weeks and feel I'm almost there but unfortunately it still doesn't work. I've picked up a few skills on the way including using the OSX Terminal and also vi editor. I've modified the file Virtual.conf as detailed in this thread. I've also created a new file called my-virtual.conf which I've saved in the /etc/frontview/apache/addons directory.
my-virtual.conf file is as follows
<VirtualHost *:80>
ServerName www.TheMadamButterfly.co.uk
DocumentRoot /websites/TheMadamButterfly
<Directory /websites/TheMadamButterfly>
Options Indexes
Order allow,deny
Allow from all
</Directory>
<Location /index.html>
SetHandler none
Order Allow,Deny
Allow from all
</Location>
SSLEngine off
</VirtualHost>
<VirtualHost *:80>
ServerName www.GabriellaKingsley.me.uk
DocumentRoot /websites/GabriellaKingsley
<Directory /websites/GabriellaKingsley>
Options Indexes
Order allow,deny
Allow from all
</Directory>
<Location /index.html>
SetHandler none
Order Allow,Deny
Allow from all
</Location>
SSLEngine off
</VirtualHost>
I've created a share to my websites directory on the ReadyNAS. Within the websites director I have two further directories names 'GabriellaKingsley' and 'TheMadamButterfly'. These two directories contain my websites. I have an index.html in both specific to each website. When I type either of the website names into Snow Leopard, it takes me to my shares directory on my ReadyNAS duo. It does not take me to my actual website.
I've changed the setting on HTTP in Services/Standard File Protocol as follows.
Redirect default web access to this share: None Selected
But still I cannot detect either of my two websites. Any suggestions as to what I'm doing wrong.
With regard to the new addon 'my-virtual.conf', I've assumed that this will load automatically, or do I have to load it myself. I cannot see the file under Services/Installed Add-ons. I've rebooted the ReadyNAS and also performed a volume scan but still no luck. This has the potential to be a great add-on if only I can get it to work.
Many Thanks
Phil - dbott67GuideTry setting the path from /websites/TheMadamButterfly to /c/websites/TheMadamButterfly (/c is the data volume and would need to be included in the path). For example:
<VirtualHost *:80>
ServerName www.TheMadamButterfly.co.uk
DocumentRoot /c/websites/TheMadamButterfly
<Directory /c/websites/TheMadamButterfly
Options Indexes
Order allow,deny
Allow from all
</Directory>
<Location /index.html>
SetHandler none
Order Allow,Deny
Allow from all
</Location>
SSLEngine off
</VirtualHost><VirtualHost *:80>
ServerName www.GabriellaKingsley.me.uk
DocumentRoot /c/websites/GabriellaKingsley
<Directory /c/websites/GabriellaKingsley
Options Indexes
Order allow,deny
Allow from all
</Directory>
<Location /index.html>
SetHandler none
Order Allow,Deny
Allow from all
</Location>
SSLEngine off
</VirtualHost>
-Dave - WhoCares_Mentor
dbott67 wrote: Try setting the path from /websites/TheMadamButterfly to /c/websites/TheMadamButterfly (/c is the data volume and would need to be included in the path).
SInce the ReadyNAS has the habit of creating symlinks for every share in the / dir, this shouldn't be neccessary. However, it's advisable to use the full path whenever possbile nevertheless.
-Stefan - Event_HorizonAspirantThe Simple Solutions are always the Best
I've been playing around with this for about a week and just could not get it to work as per the original posting by devbobo. Along the way I learnt to use the Terminal command editor and also the vi editor to modify and create new system files. In frustration I sat down with a large G&T and thought out a few other possible solutions. Luckily for me my first solution worked and it's so simple. It literally took me less than 5 minutes to set up the multiple websites.
Firstly I created a webserver on my ReadyNAS DUO in accordance with these instructions http://www.readynas.com/?p=135
This procedure will allow you to host a single website.
I created a folder in the root directory of my ReadyNAS called websites as detailed in the above procedure. I then re-directed default web access to the 'websites' share in Services/Standard File Protocols in Frontview. Remember the 'websites' share must be read only. Within my 'websites' directory I then created additional directories for my other websites.
I have 3 websites that I am using for a test which you can try out.
Event-Horizon.cc
Event-Horizon.uk.com
EventHorizon.co
I actually include the various suffixes in the directory name so that the site easier to recognise.
Enter www.event-horizon.cc into your browser to try out the first site.
It's not necessary to set up any shares for the other directories, they simply have to exist with of course the appropriate index.html file and other associated files although these are not necessary for a single page website.
I use Web Forwarding in my domain name description to redirect the various website name(s) to my ip address. I then add the full path of my website within this forwarding rule to take it straight to the relevant directory as detailed below.
http://xx.x.xxx.xxx/websites/Event-Horizon.cc
This solution does not require any knowledge of unix commands or editor commands and you do not have to play around with any of the system files.
The major benefit for using the ReadyNAS to host one's website is that you do not have to get involved in ftp and uploading the website to the host server etc.
Best of Luck
Phil - WhoCares_MentorHey,
Great you found a solution.
-Stefan - SandsharkSensei - Experienced User
WhoCares? wrote: mdgm wrote: Hopefully a firmware re-install would get the NAS working again.
That's one of the problems because most likely it wouldn't.
-Stefan
I was messing with such things for quite a while before biting the bullet and enabling root SSH. I was using eXplorer and PHP shell. The problem, of course, is that both of those access via Apache, and if you trash Apache, you can't undo them.
Having done so three times before enabling root SSH to give me an option, I can vouch that a reinstall overwrites Virtual.conf and htppd.conf. It does not erase non-default files, though, at least in the primary apache directory. Don't know about in addons.
So if all the changes you make are in the standard files, the worst that a user should have to do is a firmware re-install to undo a mess. - Event_HorizonAspirantHi
That is the beauty of my solution. You do not have to enable root SSH access and you don't need to play around with apache or any of the system files so the chances of trashing the system are negligible. It is therefore unlikely that you will need to do a hardware re-install with this solution.
You do not need to create any additional files in the addons directory and the only system file that is changed is Virtual.conf which is changed within frontview.
Cheers
Phil - tjerk1AspirantThanks in advance :) It works on my duo, but i got one warning when starting apache-ssl:
[Warn] _default_ VirtualHost on port 80, the first has precedence
I solved it by edit /etc/frontview/apache/httpd.conf and added:
NameVirtualHost *:80
Before the lines:
Include /etc/frontview/apache/Ports.conf
Include /etc/frontview/apache/Virtual.conf
Include /etc/frontview/apache/addons/*.conf
Include /etc/frontview/apache/Shares.conf - CrogAspirantHi,
Thanks so much for starting this great forum. I have got a website setup on my new NAS DDO working perfectly now.
One issue I have that is slightly off subject is setting up emails for the domain(s). The NAS obviously does not have any mail server or is there a way to install one? What have you guys done to resolve this issue. I know I can create an MX record for the domain to send the mail to a different mail server but my the mail is rejected as its not for the correct domain! Any help here would be greatly appreciated. - stinhamboAspirantI'm getting redirected to the Shares site too. I'm setting my hosts file to 192.168.x.x test.nas (which is the servername) but I haven't forwarded the IP address using Port Forwarding. Do I need to do this to get it to work?
Related Content
NETGEAR Academy

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