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
- WhoCares_Mentor
devbobo wrote: If above changes were made to the Virtual.conf file by the ReadyNAS team....the risk of that happening would be reduced considerably and that would open up the prospect of making this into an Add-on which would remove the risk all together.
Actually I've been playing with the thought myself. But after some consideration I realized, that this will mean a whole shitload (sorry ;)) of additional work to bake this into an addon. Starts with creating the directories, goes on to making sure that the vHost definitions are correct, supporting different DocumentIndex files (like index.php -> checking whether PHP is installed? -> ... ), possibly setting up of shares (which user to give access by default?) and on and on and on. That's why I refrained from posting. So: hat tip to you for being bold ;)
-Stefan - mdgm-ntgrNETGEAR Employee Retireddevbobo, if you wish to develop an add-on you can start by looking here: How to Develop a Frontview Add-On
If NetGear doesn't change the config file, you may need to get the add-on to backup the conf files after a change. Then setup a button that results in the conf files being restored from backup.
It'd be a lot of work, but if you want to do it, go for it. - devboboAspirant
WhoCares? wrote: devbobo wrote: If above changes were made to the Virtual.conf file by the ReadyNAS team....the risk of that happening would be reduced considerably and that would open up the prospect of making this into an Add-on which would remove the risk all together.
Actually I've been playing with the thought myself. But after some consideration I realized, that this will mean a whole shitload (sorry ;)) of additional work to bake this into an addon. Starts with creating the directories, goes on to making sure that the vHost definitions are correct, supporting different DocumentIndex files (like index.php -> checking whether PHP is installed? -> ... ), possibly setting up of shares (which user to give access by default?) and on and on and on. That's why I refrained from posting. So: hat tip to you for being bold ;)
-Stefan
I think you might be over-complicating it (or maybe it's me simplifying it too much)...but for the add-on i had in mind, the user would add the ServerName and DocumentRoot for each website they wanted to host. From info that it should be pretty simple to create to .conf file to put in /etc/frontview/apache/addons. I don't really care about creation of shares etc, that is admin crap that doesn't really have to live in the addon. Am I missing something ? :? - mdgm-ntgrNETGEAR Employee RetiredYou have to be careful. If people who don't have SSH enabled install the add-on and it stuffs up so that Frontview can't be accessed... then that's not going to be too good.
Hopefully a firmware re-install would get the NAS working again. - devboboAspirant
mdgm wrote: devbobo, if you wish to develop an add-on you can start by looking here: How to Develop a Frontview Add-On
If NetGear doesn't change the config file, you may need to get the add-on to backup the conf files after a change. Then setup a button that results in the conf files being restored from backup.
It'd be a lot of work, but if you want to do it, go for it.
thanks, I've already been looking at the doco. Might have a play tonight. - WhoCares_Mentor
devbobo wrote: Am I missing something ? :?
No, not really. Just the thing about "giving the little finger and have your arm torn out". Besides that, I guess you'd be home safe :-D
-Stefan - WhoCares_Mentor
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 - mdgm-ntgrNETGEAR Employee Retired
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
Ok. So yeah SSH installed would be a must. Also a simple script to restore default conf files. That could be started by e.g.
/c/script.sh
or whatever you want to call it. That should fix a problem if something goes drastically wrong (I think). If it doesn't then perhaps a script (with files from a working system on the same firmware version) may need to be downloaded. - WhoCares_Mentor
mdgm wrote: Ok. So yeah SSH installed would be a must.
See, there we go. When I started developing addons I was under the impression that it would be clear to users that having SSH enabled was mandatory before installing an addon. Well, turns out I was wrong.mdgm wrote: Also a simple script to restore default conf files.
It'd be even easier than that. Just have Netgear modifiy Vhost.conf like suggested and add a line likeInclude /etc/frontview/apache/VHost_user.conf
This file could exist as a 0 byte sized file to be filled by the addon. Make sure that a firmware reinstall overwrites the file with the 0 byte sized version and you're ... well ... somewhat safe there.
-Stefan
Edit: Still, I've been thinking about this a lot. And I've always come to the same conclusion: If you can do it, you don't need an addon. If you can't do it ... well, maybe then you shouldn't ;) - dbott67GuideStefan, thanks for the explanation and to the rest for the enlightening posts. It does make sense and I think I may tinker around a bit when I get some free time. This looks very interesting... 8)
Related Content
NETGEAR Academy

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