hlan
New Member
Posts: 41
|
Post by hlan on Apr 15, 2010 4:04:15 GMT 7
It would be great, if somebody could provide a web server module.
|
|
|
Post by sayuti on Apr 23, 2010 11:12:13 GMT 7
yes.. i agree...but not sure whether it can support in term of perfomance
|
|
hlan
New Member
Posts: 41
|
Post by hlan on Apr 23, 2010 15:59:39 GMT 7
Perhaps the web server is not super fast, but if the N2100 can have a web module, and if the N2200 can support web disk, why don't provide also a web module for the N2200?
|
|
hlan
New Member
Posts: 41
|
Post by hlan on Apr 30, 2010 3:44:55 GMT 7
I really would like this web server module. So some questions to the Unix-literate audience ....
In my view, the N2200 already has a web server module that drives the admin and Web Disk access (e.g. /img/www/htdocs/adm/index.php). So why install another web server? Presume the question then is how to move ones own files correctly there?
With the "tools"/"knowledge" that I have so far, creating entries there is painful, e.g. e.g. /img/www/htdocs/MyAlbum.
Is there a way under Unix to extend/continue/link (via permanent path) the directory /img/www/htdocs to, for example, /raid/data/MyWWW - with MyWWW being a user folder that I created from the Storage Management module - and that then would be a location/folder that I could easily manage/maintain from the Web Disk and/or upload from FTP?
Any comments?
|
|
misha
New Member
Posts: 35
|
Post by misha on Apr 30, 2010 20:26:25 GMT 7
yes, it is easy to create a symbolic link... make sure you have a directory existing first, example:
/raid/data/MyWWW
Then create a link to it (assuming MyAlbum does not yet exist):
ln -s /raid/data/myWWW /img/www/htdocs/MyAlbum
see what it looks like with:
ls -l /img/www/htdocs/
You may need to change the owner, group or mode, or it may work as is.
It is worth understanding the output of the long listing, plenty of websites for this, in short: drwxrwxrwx apple fruit mydirectory means "directory", user "apple" has permissions read-write-execute, same with group "fruit" and other. a minus sign means missing permission.
|
|
hlan
New Member
Posts: 41
|
Post by hlan on May 1, 2010 16:59:34 GMT 7
Thanks, Misha. The basic principle works.
1) Storage -> Share Folder --> --> Add MyWWW (browsable=Yes, public=Yes)
2) For windows-damaged folks like me, map network drive MyWWW --> Create or copy in there a web site, e.g. Flowers this gives you /raid/data/myWWW/Flowers
3) In ROOTCMD module create a symbolic link to that web site --> ln -s /raid/data/myWWW/Flowers /img/www/htdocs/Flowers
4) In web browers type http://<N2200 IP address>/Flowers and here you are ...
So if I or somebody wants to publish a web site this is possible.
Misha, I would like to make step 3 obsolete - is there a way to chain directories under Linux? Example:
Folder Animals contains file Rabbit Folder Birds contains file Eagle
Can Animals and Birds be chained so that "ls Animals" outputs: - Rabbit - Eagle
Again, thank you very much in advance.
|
|
misha
New Member
Posts: 35
|
Post by misha on May 2, 2010 6:58:07 GMT 7
Hi hlan,
Interesting ideas you have. I'll spell out a few scenarios, hopefully one of them is close to what you want.
The simplest way is to link to a folder, and then you can structure the folder however you like.
For example: ln -s /raid/data/myWWW /img/www/htdocs/myBeautifulWeb
Then if you have the following /raid/data/myWWW/Animals/Rabbit/index.html /raid/data/myWWW/Birds/Eagle/index.html /raid/data/myWWW/Birds/BlueTit/index.html
The web sites can be accessed by: http://ip/myBeautifulWeb/Animals/Rabbit http://ip/myBeautifulWeb/Birds/Eagle http://ip/myBeautifulWeb/Birds/BlueTit
If you want to access the web sites with a shorter url, for example:
http://ip/myBeautifulWeb/Rabbit http://ip/myBeautifulWeb/Eagle
Then the Rabbit and Eagle folders need to be accessible under myWWW. You can do this either with symbolic links, or just move the folder there. example:
ln -s /raid/data/myWWW/Animals/Rabbit /raid/data/myWWW/Rabbit ln -s /raid/data/myWWW/Birds/Eagle /raid/data/myWWW/Eagle
If you want the url even shorter, for example:
http://ip/Rabbit http://ip/Eagle
Then you need the folders accessible in the htdocs directory:
ln -s /raid/data/myWWW/Animals/Rabbit /img/www/htdocs/Rabbit ln -s /raid/data/myWWW/Birds/Eagle /img/www/htdocs/Eagle
If you want to avoid having to use the "ln" command all the time, you could setup one web page where you choose which folder to link or unlink. This could look like a simplified version of the Thecus page to manage share folders.
To remove a link, use "rm" the same way as for a file, for example:
rm /img/www/htdocs/Eagle
Another scenario is to link to particular html files instead of folders, but this would be even more fiddly in my opinion.
|
|
hlan
New Member
Posts: 41
|
Post by hlan on May 2, 2010 19:16:00 GMT 7
What I found out so far - The N2200 runs an Apache web server. - The configuration file is /etc/httpd/conf/httpd.conf - The control module is /opt/apache/bin/apachectl
Some system folders are symlinked, e.g. htdocs --> /img/www/htdocs - So if the Apache server looks for the web site it goes into /img/www/htdocs (where it finds the Thecus web site for admin/web disk/photos).
What I would like to do is chain folder /img/www/htdocs (Thecus controlled) with folder /raid/data/MyWWW (user controlled). This link should be permanent (still exist after reboot of the N2200.
Then if the N2200 Apache server looks for a web site it will either find it in /img/www/htdocs or /raid/data/MyWWW.
It would be great if in the same way you've got a script for FTP in your wiki you could add a script that creates MyWWW and adds the permanent symlink then the N2200 would be ready to be used as your web server.
One issue I currently try resolving is how to protect the web site: Apache web server uses .htaccess & .htpasswd files. The mechanism is present in the N2200 web server but fails. I have some suspicion but I am not yet at the bottom of it. I'll be a happy man once .htaccss works because then I'd have all I wanted, and I would prefer it over the N2100 web server module. I do not care about integration with NAS user accounts, all I need is standard Apache behaviour (and my web site users would be other users than my NAS users anyway so I don't care about maintaining an extra Apache .htpasswd file).
|
|
|
Post by sayuti on May 5, 2010 10:55:13 GMT 7
hi hlan
What are the things that we should and should not do in order not to slow down the transfer rate ?
I start beginning to feel disturb to this NAS in term of its slow performance...not sure wether its due to user related or the machine itself
|
|
hlan
New Member
Posts: 41
|
Post by hlan on May 5, 2010 14:53:25 GMT 7
Yes, the admin tool is very slow, something I have not investigated because after all, admin functions I only do so and so often and therefore I can live with this inconvenience. As said, I have not investigated but my uninformed suspicion is that the slow performance may come from this ajax interface.
My main use case for the NAS is network storage and the performance with my network folders is acceptable. I have not measured it objectively but my feeling is that my desktop copies files to the NAS a little bit slower than copying to a USB disk. My main environment is XP & gigabit router.
My other desired use case is to use this NAS as a web server to share recent photos with the family without having to email those photos around - I want to provide them from a central place where I can add comments and presentation. [Btw, my preference is using Jalbum over the Thecus chosen module because Jalbum is very easy to use giving top results and I can prepare & preview it totally outside the NAS, i.e. am not hampered by the NAS' UI performance]
Inspecting the NAS with ROOTCMD tool told me that it uses a Apache v2.2 web server. Apache is the state-of-art web server and very well documented on the Internet (no need for documentation from Thecus).
From the posts you saw that I introduced my own website to the N2200 Apache and I was happy with the performance. I did not test over the Internet but think that rather the ISP upload will be a bottleneck than the NAS hw/Apache performance.
So far, so good. Unfortunately the Thecus "integration" of the Apache is a bit strange. In the config file they allow .htaccess for authentication but the object module that therefore is required is missing in the /modules directory. Personally, I would like to use this standard Apache functionality - especially for security matters - however, a workaround would be to add a php script. Php is enabled and the N2200 uses it heavily.
The other point, I would like to use my own web server subdirectory and not mess around in the NAS system directories. The standard Apache configuration allows for this (see virtualhost directive). I would like to use virtualhost for (a) my own directory, e.g. MyWWW/htdocs and (b) using a different port number than the one by the NAS UI - this would allow port forwarding to my website only and not expose the NAS GUI with admin and local user accounts (that may hold weak passwords because hey - why go mad with passwords within the family LAN?) Unfortunately, again Thecus have omitted the Apache module for virtualhost so I cannot use standard functionality. So my workaround is this symbolic link from the Thecus /htdocs directory to my website.
In conclusion, the basic means are available: Apache web server, workaround for basic authentication, workaround for placing the own website in a user directory. However, my preference was using standard Apache functionality and I am disappointed by Thecus because it would take their Apache specialist less than 15 minutes to provide this N200 pre-configured with virtual host from a user directory giving us the power tapping into a standard Apache server for our own use.
|
|
hlan
New Member
Posts: 41
|
Post by hlan on May 6, 2010 3:01:55 GMT 7
Virtual host is a Apache core module (so it does not be loaded). Defining a virtual host gives you an "additional" web server instance, e.g. for my investigation I created folders:
/raid/data/MyWWW /raid/data/MyWWW/htdocs /raid/data/MyWWW/logs
Under XP map /raid/data/MyWWW as network drive and manage it und its subdirectories there - drag & drop websites, e.g. created with Jalbum, and inspect log files.
In /etc/http/conf/httpd.conf create a backup copy of httpd.conf and then add the following (e.g. to the end):
Listen 0.0.0.0:8080 <VirtualHost *:8080> ServerAdmin you@example.com ServerName N2200.MyWWW.com
DocumentRoot /raid/data/MyWWW/htdocs/
<Directory /raid/data/MyWWW/htdocs/ > Options FollowSymLinks AllowOverride None </Directory>
# Logfiles ErrorLog /raid/data/MyWWW/logs/error.log CustomLog /raid/data/MyWWW/logs/access.log combined
</VirtualHost>
Then on the system prompt: - validate the syntax: /opt/apache/bin/apachectl configtest - restart the webserver: /opt/apache/bin/apachectl graceful
In the webbrowser: http://<NAS IP address>:8080 goes to /raid/data/MyWWW/htdocs/index.html http://<NAS IP address>:8080/Flowers goes to /raid/data/MyWWW/htdocs/Flowers/index.html and so on and so on.
Notes of caution/comments: - On my NAS it works and has not broken anything but I have not fully validated it. - The virtual host definition should go into seperate definition file so that it does not get wiped off by upgrades (at least that's the theory) - There is a lot of information about virtual hosts on the Internet. Enjoy googling and refining. - I liked the port-based virtual host because it allows selective port forwarding on the router. If you want to keep standard port 80 for external access you could easily switch the ports around and for example use 8080 for the admin. - For access control / authentication use php.
PS I have installed ROOTCMD and DROPBEAR/SSH but only used ROOTCMD for above. I copied the httpd.conf file to MyWWW, (shame on me) edited it under wordpad, and then copied it back into its place :-). The MyWWW folder I created from the NAS Storage management module.
|
|
|
Post by supersaucisse on May 23, 2010 1:25:06 GMT 7
A native web server would be usefull.
And better documentation to add feature too. (like a mail server etc...)
|
|
hlan
New Member
Posts: 41
|
Post by hlan on May 23, 2010 5:07:01 GMT 7
The N2200 runs an Apache 2.2 (+php). The vhost configuration creates your instance that is served from your user directory, i.e. allows easy (*) publishing of (basic) content.
* can mean painful if you do not want to deal with (html) web authoring, and configuration & integration.
I only tested up to php script for authentication but for the moment I do not see a reason why you cannot do whatever you want (if you stay within system constraints), e.g. php-based wiki or web forum - why not? Of course you cannot have x k concurrent users but who would do that on a ~150 Euro box with 128MB RAM?
An initial "constraint" for me was that mod_auth object module was not available, meaning .htaccess with .htpasswd does not work. The workaround I did for myself was php script, and complementary, in case I wanted more configured ssl mutual authentication. In some time I plan updating the MyWWW wiki for this (and some refinements).
Btw, any missing modules you could build yourself. I downloaded the GPL kit and managed to rebuild Apache with the missing object files (despite being a beginner in UNIX and Apache **). I did not set up the ARM tool chain but saw some posts about how this is done and think it could be sorted, too, if need there is.
** because of this my configuration should be seen as a starting point only - the configuratin contains room for improvement & evolution.
|
|
|
Post by matthuck on May 31, 2010 4:44:15 GMT 7
Hi Hlan,
I have a horrible sinking feeling that I messed up but am wondering in case you know any tricks to get me back and working again :)
I have a N2200 I installed rootcmd - all good. I installed fw 3.0.11 = all good I tried to follow your idea for opening up the Apache server - not so good
I used rootcmd and put sym links so that I could browse root via FTP - working fine. I uploaded btg package to improve torrent (DLM2) - all fine Then I started messing with Apache....
I copied httpd.conf, edited it as your example -
I used port 50004 instead of 8080. I have the listen line 0.0.0.0:50004
I created a share using the NAS web interface - WWW
<VirtualHost *:50004> ServerAdmin you@example.com ServerName N2200.MyWWW.com
DocumentRoot /raid/data/WWW/htdocs/
<Directory /raid/data/WWW/htdocs/ > Options FollowSymLinks AllowOverride None </Directory>
# Logfiles ErrorLog /raid/data/WWW/logs/error.log CustomLog /raid/data/WWW/logs/access.log combined
</VirtualHost>
I checked syntax as you describe via rootcmd - came back OK I then graceful restarted.
Guess - what - no access to admin interface. So am not sure what I have done wrong and therefore how to get it back.
I feel like I have probably made a mistake by not installing dropbear as I cannot get access via ftp to place the backup httpd.conf file back - permissions!
all my shares are fine and working - ftp access is fine including to root. I am gonna be gutted to have to copy off all 1tb of files, blank the box and reinstall - lotta work/time.
Any ideas - anyone? I was wondering if I can change file permissions via Terminal (OSX) or something so I can put back the original httpd.conf
any help would be great
Matt
|
|
misha
New Member
Posts: 35
|
Post by misha on May 31, 2010 23:11:28 GMT 7
Hi Matt, I answered on the other forum... forum.thecusforum.eu/showthread.php?t=3415We should vote to use just one forum and point everyone else there, having 3 active forums is ridiculous! Then again, some other things are ridiculous, so maybe it is fitting... hehe.
|
|