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_MentorStrange, didn't happen for me. Will investigate. As to the "easy Apache setup": Well, if you want a real Linux you've got to build your own box. Apparently the ReadyNAS (and other NAS boxes as well) wasn't built with the idea of users running web servers in mind. That's a design decision and unfortunately it's not that easy to revert. Anyway, I'll look into this, maybe it's just a small problem with the config I posted on Gitorious.
-Stefan - WhoCares_MentorMy bad. I just checked with my local install and found that I hadn't checked in a lot of changes to the repository on Gitorious. Please revisit the repo and see whether the new version (x86, read CHANGELOG) works for you.
-Stefan - ericclaerenAspirantThanks Stefan, I will look into it this weekend.
You're right about a plain linux machine. I thought running a webserver on this, quite powerful and machine, would be a piece of cake. Since it was just linux, but installing any software directly on it is a pain in the...
You can't update or upgrade anything easily because it's so heavily modified. Well lesson learned :D
Thanks for your help - WhoCares_MentorK, gives me some more time to push the ARM changes, too ;)
-Stefan - ericclaerenAspirantHi Stefan,
Thanks dude! It works! Used the latest git for x86.
I have added my own line to the http.conf for my own vhosts, didn't want to mess around in addons dir for my sites.
# Include sites that defines it's own vhost
Include /etc/frontview/apache/sites/*.vhost
For other users: My default vhost file now looks like this. It probably could need some extra tweaking, but it works for now.
I put my sites in a shared directory called www so I can access the files easily within my network.
Location: /etc/frontview/apache/sites/example.vhost
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
DocumentRoot /www/example
<Directory /www/example>
Options +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Location />
DirectoryIndex redirect.html index.html index.htm index.php
</Location>
<Location /index.html>
SetHandler none
Order Allow,Deny
Allow from all
</Location>
SSLEngine off
RewriteEngine On
RewriteOptions Inherit
Options +FollowSymLinks
</VirtualHost>
Thanks for your help! - WhoCares_MentorYou shouldn't place your web roots (/www/example in your case) on the main OS partition. A better approach would be to place them in a directory below /c like /c/www/example or the like.
-Stefan - ericclaerenAspirantIt isn't (think so) /www/example is in my case /c/www/example. I created a shared folder called 'www' via readynas frontview. Normally on linux I would use /var/www, would that be a better folder?
- WhoCares_MentorNo, using /www/example is fine as long as it is as you describe above. On the ReadyNAS /c and below is the big storage space and pretty much everything else is the OS partition (unless symlinked to something under /c of course).
-Stefan - ericclaerenAspirantHi Stefan,
Just installed the 4.2.20 firmware update, now my frontview is really really dead. Did you encounter this problem too?
Can't get apache started, while doing: apache-ssl -f /etc/frontview/apache/httpd.conf
I received the following errors:
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Any Idea, where this is coming from? Haven't changed anything further to my Nas.
Thanks! - WhoCares_MentorThis means that something already is sitting on port 80 - which on the ReadyNAS should be only Apache. What's the output of
ps ax | grep apache
Additionally you may want to tryapache-ssl -f /etc/frontview/apache/httpd.conf -k restart
and see whether this revives FrontView.
-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!