N2200 User Patch MyWWW

Facts

 * Name: Apache Virtual Host (MyWWW)
 * Maintainer: Misha Verplak
 * Httpd changes: hlan (all credits to hlan!)
 * Target: N2200
 * Latest version: 1
 * Firmware version 3.00.06

Disclaimer
N2200 functions rely on proper functioning of the N2200 Apache web server. Rendering the N2200 Apache web server configuration in such a way that it breaks the web server may break the N2200 NAS and make it useless. The author does not take any liability from below description - you are responsible to carefully review and run your own validation prior to committing any change.

Always run a "apachectl configtest" before loading a configuration change Only make configuration modifications in the configuration include files in the user folder, retaining yourself to remove erronious configuration changes from there.

Description
The N2200 features an Apache web server. Apache allows to configure virtual hosts (virtual web sites). The instructions here provide an example for using this feature with the N2200 to configure 1 virtual web site that serves web content from a user directory within the N2200.

The new virtual web site is identified by the TCP port number used in the URL. Using port-based virtual web sites allows easy firewall port-forwarding (enable, disable) on the router. Apache allows to configure multiple virtual web sites.

The example configuration provides a virtual web site served from user folder "MyWWW" within the N2200. The virtual web site listens to port 8000 (http) and 8443 (https). The web site is loaded with example web content (with, and without user authentication). The virtual web site logs access and traffic in folder "logs".

The N2200 firmware misses the object module for authentication by Apache, therefore authentication is php-script using freeware "Simple Text-File Login (SiTeFiLo)" script. SiTeFiLo user file is in folder "users" (text file, password in MD5 hash), the access log is under the respective web folder.

Examples for using MyWWW: http:// :8000 : document root of MyWWW, with index.html example for navigating to subfolders http:// :8000/Flowers : navigate directly to subfolder http:// :8000/Animals : idem, but with php-based authentication http:// :8000/phptest/index.php : navigate directly to file in subfolder, here a php script

https:// :8443 : as above but with https

The little icon displayed in front of the web site URL / tab comes from file "MyWWW/favicon.ico" - replace this icon by another one of your choice (google the Internet for favicon).

Prerequisite
ROOTCMD module

Installation
1) In N2200 admin tool open module Storage (Share Folder, add) to create a folder named "MyWWW" (Browseable=Yes, Public=Yes)

2) Under Windows XP, MyComputer (Tools, Map network drive) open folder "MyWWW" 2a) Extract the contents of the zip file into "MyWWW" 2b) The proposed virtual web site listens to port 8000 (http) and 8443 (https). If this port is already used by your router for port forwarding, or if you want to use a different port number, then in folder "conf" edit file "MyWWW.conf" or "MyWWW-ssl.conf", and replace with your selected port number

3) In N2200 admin tool open Module Management (User Module, ROOTCMD) 3a) Create a backup copy of your current N2200 Apache configuration file, in ROOTCMD do: cp /etc/httpd/conf/httpd.conf /raid/data/MyWWW/conf/httpd-bck.conf

3b) Replace the current N2200 Apache configuration file with the new configuration file "httpd.conf" that includes for the MyWWW vhost configuration.     Note: the only change added were the following 2 lines found at the end of the file:            # Include MyWWW configuration       Include /raid/data/MyWWW/conf/MyWWW.conf

In ROOTCMD do: cp /raid/data/MyWWW/conf/httpd.conf /etc/httpd/conf/httpd.conf

3c) Restart the N2200 Apache server, in ROOTCMD do:  /opt/apache/bin/apachectl configtest : Must output "Syntax OK" otherwise there is a problem requiring rollback   /opt/apache/bin/apachectl graceful : this will restart the N2200 Apache httpd web server

Rollback, delete, revoke
N2200 startup will reload automatically this configuration once set. To rollback / revoke / delete the custom configuration copy back "httpd-bck.conf" that is located in folder "conf" cp /raid/data/MyWWW/conf/httpd-bck.conf /etc/httpd/conf/httpd.conf

How this works
Exploits standard functionality (port-based vhost) of Apache 2.2 server. Configuration example, no additional software. Apache will listen to an additional port, and when used, navigate to the declared alternate document root for web content. The alternate document root is created in a user folder, that can be managed without going into the N2200 admin tool, and without further need of configuration in N2200.

Features

 * Example for Apache port-based virtual host configuration
 * Example for using configuration with web content (photo albums created with freeware "Jalbum")

News

 * 2010-05-xx: First version uploaded to NAS Central

Versions

 * Version 1.0
 * Release date: 2010-05-05
 * Works on firmware: 3.00.06
 * Download (zip): N2200-MyWWW-1.7z

N2200 User Patches