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
- ericclaerenAspirantThanks, have you updated your Nas to the latest version?
This is the result of the ps ax grep3137 pts/0 S+ 0:00 grep apache
When executing the apache-ssl command, I receiving the same error message
[Fri Apr 27 15:00:54 2012] [warn] module php5_module is already loaded, skipping
[Fri Apr 27 15:00:54 2012] [warn] module php5_module is already loaded, skipping
httpd not running, trying to start
(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
Don't get why this is happening after the update, everything was running just fine.
Thanks for your help! - WhoCares_MentorWell, it's a problem with the alternative apache configs. They got partially overwritten by the upgrade. Can you please try to do this:
cp /etc/frontview/apache/Virtual.conf /etc/frontview/apache/Virtual.conf.sav
cp /usr/share/apache-configs/x86/etc/frontview/apache/Virtual.conf /etc/frontview/apache/
apache-ssl -f/etc/frontview/apache/httpd.conf -k restart
(Will only work if you used the installer from the Gitorious repository)
-Stefan - ericclaerenAspirantHi Stefan,
I replaced Virtual.conf + http.conf from your git repo again and it worked! Thanks mate!
Now I have to setup my local sites again, since I did'nt had a proper backup of my /etc/frontview/apache. Lesson learned :wink: - leoj3nAspirantHey, it seems apache can't find "/images/Pix.gif" when doing a directory listing after applying WhoCares?'s apache config.

Does anyone know how to fix this? I'd like to have those images for directory listings if possible.
Note: other than this everything worked fine. - WhoCares_MentorI'm a bit confused for your directory listing doesn't show any images directory, so how should apache be able to find the image ;) Also, did you apply the whole config or just some parts? In the latter case there's a good chance you still have the global override for the images dir active that is present in the original configs. And lastly, you did a restart of the web server after making changes to the configs, right?
- leoj3nAspirantHere's my apache directory from /etc/frontview/: http://leoj3n.otzo.com/apache.tar.gz
In FrontView I have 1 share titled 'public_html' that is chown admin:admin, chmod 775 which holds a directory called leoj3n which is referenced by /etc/frontview/apache/sites/leoj3n.otzo.com.vhost ...
Under Services in FV, HTTP is set to None selected/Disabled ...
---
It's very possible I messed something up as as I ran into a lot of problems, which stemmed mainly from the fact that I wasn't seeing the config working because I didn't realize I needed to clear the catch of my browser in order to see the changes... I ended up trying a lot of whacky stuff before I narrowed it down to the browser cache problem.
Another problem I ran into was that ReadyNAS Photos II didn't play nice with the new vhost config. I hade to uninstall it using the .remove file because the addon totally faceplanted and took FrontView with it once I replaced the existing files with those from Gitorious.
Anyways, here's the URL where the images are absent: http://leoj3n.otzo.com/OREGONTRAILII/ (internally: /public_html/leoj3n/OREGONTRAILII/)
---
Another note: When I run the apache restart command (apache-ssl -f /etc/frontview/apache/httpd.conf -k restart) I get this warning:apache-ssl: Could not reliably determine the server's fully qualified domain name, using 10.0.1.2 for ServerName
- WhoCares_MentorAs said above, from a first look it seems that there is no images directory so that's why you're not seeing any. I haven't had time to look at the archive of your configs yet but I will hopefully find time to do so tomorrow.
- leoj3nAspirantIn /etc/frontview/apache/DefAlias.conf there is the directive:
Alias /images/ /frontview/ui/resource/images/
<Directory /images>
Options MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
The page at http://leoj3n.otzo.com/OREGONTRAILII/ is looking for (for example) /images/Icons/folder.gif and there does exist a directory on the ReadyNAS /frontview/ui/resource/images/Icons/ which contains:addlunOff.gif binary.gif clearlog.gif dvi.gif folder.gif modifylunOff.gif script.gif text.gif volumeSmall.png
addlunOn.gif binhex.gif compressed.gif elbow-end.gif hand.right.gif modifylunOn.gif sound2.gif unknown.gif warning.png
a.gif bomb.gif deleteLunOff.png elbow.gif image2.gif movie.gif tar.gif uuencoded.gif world2.gif
back.gif c.gif deleteLunOn.png f.gif layout.gif p.gif tex.gif viewlog.gif
---
In /etc/frontview/apache/sites/leoj3n.otzo.com.vhost I changed /public_html/leoj3n to /c/public_html/leoj3n then restarted apache & cleared browser cache but no luck. The file looks like this after those changes:<VirtualHost *:80>
ServerName leoj3n.otzo.com
ServerAlias leoj3n.otzo.com
DocumentRoot /c/public_html/leoj3n
<Directory /c/public_html/leoj3n>
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>
:nashammer:
---
Found some icon related directives in /etc/frontview/apache/httpd.conf:<IfModule mod_autoindex.c>
IndexOptions Charset=
IndexOptions FancyIndexing NameWidth=*
AddIconByEncoding (CMP,/images/Icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/images/Icons/text.gif) text/*
AddIconByType (IMG,/images/Icons/image2.gif) image/*
AddIconByType (SND,/images/Icons/sound2.gif) audio/*
AddIconByType (VID,/images/Icons/movie.gif) video/*
AddIcon /images/Icons/binary.gif .bin .exe
AddIcon /images/Icons/binhex.gif .hqx
AddIcon /images/Icons/tar.gif .tar
AddIcon /images/Icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /images/Icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /images/Icons/a.gif .ps .ai .eps
AddIcon /images/Icons/layout.gif .html .shtml .htm .pdf
AddIcon /images/Icons/text.gif .txt
AddIcon /images/Icons/c.gif .c
AddIcon /images/Icons/p.gif .pl .py
AddIcon /images/Icons/f.gif .for
AddIcon /images/Icons/dvi.gif .dvi
AddIcon /images/Icons/uuencoded.gif .uu
AddIcon /images/Icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /images/Icons/tex.gif .tex
AddIcon /images/Icons/bomb.gif core
AddIcon /images/Icons/back.gif ..
AddIcon /images/Icons/hand.right.gif README
AddIcon /images/Icons/folder.gif ^^DIRECTORY^^
AddIcon /images/Pix.gif ^^BLANKICON^^
DefaultIcon /images/Icons/unknown.gif
ReadmeName /html/AUTOINDEX.html
HeaderName HEADER.html
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
</IfModule> - leoj3nAspirantI may have another issue: index.php in /public_html/*/index.php just gets downloaded.
To try and solve that, in the *.vhost file I tried adding Options ExecCGI in the the first Location directive:
<Location />
Options ExecCGI
DirectoryIndex redirect.html index.html index.htm index.php
</Location>
But that just gave the error:Forbidden
You don't have permission to access /index.php on this server.
See the error live: http://2011cc.otzo.com/index.php
Any help on these issues would be very much appreciated by myself. Thank you. - leoj3nAspirantOK now I am starting to wrap my head around apache... Adding the directive I found in /etc/frontview/apache/DefAlias.conf to /etc/frontview/apache/sites/*.vhost fixed the directory listing image problem:
<VirtualHost *:80>
ServerName leoj3n.otzo.com
ServerAlias leoj3n.otzo.com
DocumentRoot /c/public_html/leoj3n
<Directory /c/public_html/leoj3n>
Options +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# ADDED THIS DIRECTIVE
Alias /images/ /frontview/ui/resource/images/
<Directory /images>
Options MultiViews
AllowOverride None
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>
---
But I still have the issue of index.php being directly downloaded instead of executed...
This is what I see in /var/log/frontview/error.log when I restart apache-ssl...[Sat Jul 14 17:47:36 2012] [notice] SIGHUP received. Attempting to restart
apache-ssl: Could not reliably determine the server's fully qualified domain name, using 10.0.1.2 for ServerName
[Sat Jul 14 17:47:36 2012] [warn] RSA server certificate CommonName (CN) `10.0.1.26' does NOT match server name!?
[Sat Jul 14 17:47:36 2012] [notice] Apache/2.2.6 (Debian) mod_ssl/2.2.6 OpenSSL/0.9.8c DAV/2 mod_apreq2-20051231/2.6.0 mod_perl/2.0.2 Perl/v5.8.8 configured -- resuming normal operations
Should I be seeing something about mod_php5 in there?
I followed the tutorial at http://www.readynas.com/?p=140 to set up a PHP CGI environment... Do you think this issue has to do with the WhoCares? apache configs or is it unrelated and should have its own thread?
---
I tried addingLoadModule php5_module /usr/lib/apache2/modules/libphp5.so
AddHandler php5-script .php
#AddType text/html .php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
to /etc/frontview/apache/httpd.conf and added "+ExecCGI" to /etc/frontview/apache/sites/2011cc.otzo.com.vhost:<Directory /c/public_html/2011cc>
Options +FollowSymLinks +ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
I restarted apache-ssl, cleared cache, but still no progress. Running out of ideas, most likely because I don't know enough about apache configs.
This is what now gets logged in error.log upon apache-ssl restart:[Sat Jul 14 17:47:36 2012] [notice] SIGHUP received. Attempting to restart
apache-ssl: Could not reliably determine the server's fully qualified domain name, using 10.0.1.2 for ServerName
[Sat Jul 14 17:47:36 2012] [warn] RSA server certificate CommonName (CN) `10.0.1.26' does NOT match server name!?
[Sat Jul 14 17:47:36 2012] [notice] Apache/2.2.6 (Debian) mod_ssl/2.2.6 OpenSSL/0.9.8c DAV/2 mod_apreq2-20051231/2.6.0 mod_perl/2.0.2 Perl/v5.8.8 configured -- resuming normal operations
Related Content
NETGEAR Academy
Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!