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
- leoj3nAspirantStefan,
I tried re-applying your patch. Here is how:alfa-nas:/etc/frontview# ls apache.bak/ #<--- Config before apply WhoCares?'s patch
04d1e7c3.0 addons apache.pem Auth.conf httpd.conf Ports.conf Shares.conf Shares.conf.1 Shares.conf.2 ssleay.cnf Virtual.conf
alfa-nas:/etc/frontview# ls apache.add/ #<--- Pulled from Gitorious
Auth.conf AuthVhost.conf DefAlias.conf httpd.conf PerlSettings.conf Ports.conf ssleay.cnf Virtual.conf
alfa-nas:/etc/frontview# rm -rf apache
alfa-nas:/etc/frontview# cp -rf apache.bak/ apache
alfa-nas:/etc/frontview# cp -rf apache.add/* apache
alfa-nas:/etc/frontview# ls apache.upd/sites/ #<--- My custom *.vhost files
2011cc.otzo.com.vhost leoj3n.no-ip.org.vhost leoj3n.otzo.com.vhost mom.otzo.com.vhost
alfa-nas:/etc/frontview# cp apache.upd/sites/*.vhost apache/addons/
alfa-nas:/etc/frontview# ls apache
04d1e7c3.0 apache.pem AuthVhost.conf httpd.conf Ports.conf Shares.conf.1 ssleay.cnf
addons Auth.conf DefAlias.conf PerlSettings.conf Shares.conf Shares.conf.2 Virtual.conf
alfa-nas:/etc/frontview# ls apache/addons/
2011cc.otzo.com.vhost leoj3n.no-ip.org.vhost mom.otzo.com.vhost PHPMYADMIN.conf RSNAPSHOT.conf
DNSOMATIC.conf leoj3n.otzo.com.vhost phpadmweb.conf PLEXMEDIASERVER.conf
alfa-nas:/etc/frontview# apache-ssl -f /etc/frontview/apache/httpd.conf -k restart -V
Server version: Apache/2.2.6 (Debian)
Server built: Feb 28 2008 22:43:28
Server's Module Magic Number: 20051115:5
Server loaded: APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture: 32-bit
Server MPM: Prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=128
-D HTTPD_ROOT=""
-D SUEXEC_BIN="/bin/suexec"
-D DEFAULT_PIDLOG="/var/run/apache2.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="/var/run/apache2/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
-D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"
Just trying to eliminate any possible causes of the problems I am still facing. Any ideas? :( - leoj3nAspirant
leoj3n wrote: Changing from /sites/ to /addons/ was fruitless. However I tried going to http://2011cc.otzo.com/index.php which gives the output: Your server is running PHP version 5.2.0-8+etch16 but WordPress 3.4.1 requires at least 5.2.4.
However if you don't go directly to the index.php file you still get the permissions thing: http://2011cc.otzo.com/
An update: I finally thought to remove the .htaccess included with (correction: generated by, because I copied the WordPress files from my Desktop which was running a webserver and active WordPress install) WordPress and now the permission error goes away when you visit http://2011cc.otzo.com/
Going to http://2011cc.otzo.com/ does a directory-listing however, and doesn't automatically query index.php - that is what I will work on next.
Update: I had removed the following from the custom .vhost file during testing:<Location />
Adding it back causes index.php to be downloaded when visiting http://2011cc.otzo.com/ or http://2011cc.otzo.com/index.php ...
DirectoryIndex redirect.html index.html index.htm index.php
</Location> - WhoCares_MentorMy best guess right now is that by jsut copying over the existing files some fragments still interfere with the general operation of your Apache config. Try removing the apache config dir completey (of course only after you've made yet another backup ;)) and copy over the x86 config from the gitorious repo. Then copy back the add-on subdir. Also, if I'm not completely mistaken there should be an installer script in the repo, no?
-Stefan - leoj3nAspirantUnfortunately I totally missed the install.sh script when I started this whole charade. I just copied the x86 dir using cp, and that's what I've been doing up until this point. Sorry for my ignorance, I've never run a .sh file until today.
To attempt to start from scratch I did the following, please look this over (apache.bak is the backup of the original /apache/ folder, made before doing any modifications):alfa-nas:/etc/frontview# rm -rf apache
alfa-nas:/etc/frontview# cp -rf apache.bak/ apache
alfa-nas:/etc/frontview# apache-ssl -f /etc/frontview/apache/httpd.conf -k restart
apache-ssl: Could not reliably determine the server's fully qualified domain name, using 10.0.1.2 for ServerName
alfa-nas:/etc/frontview# cd /c/home/admin/System\ Stuff/NAS/apache-configs/
alfa-nas:/c/home/admin/System Stuff/NAS/apache-configs# sudo bash install.sh
apache-ssl: Could not reliably determine the server's fully qualified domain name, using 10.0.1.2 for ServerName
Syntax OK
apache-ssl: Could not reliably determine the server's fully qualified domain name, using 10.0.1.2 for ServerName
alfa-nas:/c/home/admin/System Stuff/NAS/apache-configs# cd -
/etc/frontview
alfa-nas:/etc/frontview# cp apache.upd2/addons/2011cc.otzo.com.vhost apache/addons/
alfa-nas:/etc/frontview# apache-ssl -f /etc/frontview/apache/httpd.conf -k restart
apache-ssl: Could not reliably determine the server's fully qualified domain name, using 10.0.1.2 for ServerName
alfa-nas:/etc/frontview# cat apache/addons/2011cc.otzo.com.vhost
<VirtualHost *:80>
ServerName 2011cc.otzo.com
ServerAlias 2011cc.otzo.com
DocumentRoot /c/public_html/2011cc
#LoadModule 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
<Directory /c/public_html/2011cc>
Options +FollowSymLinks +ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
<Location />
#Options ExecCGI
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>
alfa-nas:/etc/frontview#
PHP files are still being downloaded instead of output to the browser. I even tried restarting the NAS (just for fun?) but the problem persists.
Thanks for all your attention Stefan. Does your config on your server serve up PHP files correctly? If so I think we can narrow this down to php_mod being installed incorrectly. At that point I will probably try using your FrontView PHP add-on. - WhoCares_MentorActually my config does nothing to allow/prevent PHP scripts from being executed / served to the user. This should be handled by the libapache2-mod-php5 module. Unfortunately this will add it's config to a file that isn't read by the ReadyNAS' Apache web server. What you can try to do is to create the file '/etc/frontview/apache/addons/00_phpload.conf' with this contents:
<IfModule mod_php5.c>
LoadModule 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
</IfModule>
Restart Apache and see whether this changed anything.
-Stefan - leoj3nAspirantNo, no changes. In the custom vhost I tried
<Location />
and
DirectoryIndex redirect.html index.html index.htm index.php
</Location><Location />
Options ExecCGI
DirectoryIndex redirect.html index.html index.htm index.php
</Location>
but that had no effect either. When I visit http://2011cc.otzo.com/ it still just downloads the damned PHP file. :evil:
The output of apache-ssl -f /etc/frontview/apache/httpd.conf -M contains no references to php. - leoj3nAspirantStefan (WhoCares?) helped me privately and we got it sorted. I posted the critical factor here: viewtopic.php?f=35&t=64537
Here's my final config, it should be useful to anyone else trying to set up virtual hosts + PHP (& I've included an example that fixes directory images): http://leoj3n.otzo.com/example-apache-a ... fig.tar.gz
Important files:
/etc/frontview/apache/addons/sub.domain.com.vhost #example virtual host
/etc/frontview/apache/addons/dirlist.domain.com.vhost #example virtual host that supports directory images
/etc/frontview/apache/addons/domain.com.vhost #example virtual host that utilizes ServerAlias
/etc/frontview/apache/addons/00_php5module.conf #php5 config file; without this .php files download instead of output to the browser
Here are the steps the I believe resulted in my eventual success:
First, backup your current configurationcp -rf /etc/frontview/apache/ /etc/frontview/apache.bak/
Change settings in FrontView -> Standard File Protocols -> HTTP
Redirect default web access to this share: None selected
Login authentication on this share: Disable
Clone WhoCares?'s apache-configs repo on Gitorious
Link: https://gitorious.org/readynas/apache-configs
Git clone command:git clone git://gitorious.org/readynas/apache-configs.git apache-configs
Run the apache-configs install filecd ./apache-configs/; sudo bash install.sh
Create a .vhost file in /etc/frontview/apache/addons/cd /etc/frontview/apache/addons/; touch YOUR.DOMAIN.com.vhost
The contents of YOUR.DOMAIN.com.vhost should be something like:<VirtualHost *:80>
ServerName YOUR.DOMAIN.com
DocumentRoot /YOUR_HTML_SHARE/a_sub_dir
<Directory /YOUR_HTML_SHARE/a_sub_dir>
Options +FollowSymLinks +ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
DirectoryIndex redirect.html index.html index.htm index.php
<Location /index.html>
SetHandler none
Order Allow,Deny
Allow from all
</Location>
SSLEngine off
RewriteEngine On
RewriteOptions Inherit
Options +FollowSymLinks
</VirtualHost>
Restart Apacheapache-ssl -f /etc/frontview/apache/httpd.conf -k restart
- mattkingstonAspirantHi all,
Very sorry im several years late with this one.
Im a little new to this virtual hosting bu i wish to host more than one website on my Readynas Duo
I can across a very usefull guide here on how to setup for multiple hosts with the virtual.conf file however, im unsure how to get to this file in order to modify it.
I cant find it via windows explorer so i assume i must use ssl??? (which im also new too)
Any tips on the best way to modify the conf file would be great.
thanks in advance! - AssassinsAspirantHmmmm this guide work not on the Duo v1 2110
I get a blank site :(
I have try this guide many time now, and same result...
Related Content
NETGEAR Academy
Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!