PDA

Bekijk de volledige versie : running a second webserver



ronin
15-05-2004, 20:39
I bought this wl500g a couple of weeks ago and it runs very smoothly. I use Oleg's CR3 firmware and got my printer working instantly (hp940C). My external USB HD (2,5) runs as an ftp disk, and wireless is running like a charm. While everything is setup nicely it's time to discover more features. Therefore I've got a couple of questions which you can probably answer for me (please keep in mind I'm not a Linux guru ;-).

1) I read in this forum that it is possible to use the httpd daemon as a webserver to host your own website as well. So I created a WWW on the USB HD and ran kill httpd. placed my own asp in the www dir and then restarted the daemon. It makes my asp available for the outside world, but only accessible under the admin account. Besides that it stopped my router's GUI working properly. So I was wondering what is the right way to do this without to dissable the routers GUI. Do I need to run another instance of Httpd?How do I do this and make it accessible without the Admin account.

2) On another location in this forum I read that some people were running their routersoftware on external HD. What are the advantages of this?

3) My last question is, is it possible to preconfigure HD amount per ftpuser? Besides that I want to create one directory with readonly access available for all users. So not the anonymous users. Can you tell me how?

Thanks in advance and keep up the good work guys!!

greetz Ronin

Royan
16-05-2004, 02:41
Not certain in I understood correctly, but here's an attempt to answer question 3.

I haven't found/heard anything about quotas on the ftp server in the Asus router. The ftp daemon used is 'stupid-ftpd'. Source and more info is available at http://sourceforge.net/projects/stupid-ftpd/.

If you disable anonymous access and create a user 'anonymous' with password '*', this will work exacly like a real anonymous user, only you can set whatever access rights you want, including 'Read Only'. The new anonymous user will have access to the '/ftp_pub/' folder.
That's probably the closest you'll get to creating a shared read-only folder.

Royan

ronin
21-05-2004, 08:16
Hi Royan,

This is partially what I meant. However after doing some workarounds it works.

Thanxz a lot!

I still wonder however if it's possible to run a second instance of the webserver. Or add an additional webserver. I dunno what's best.

I just want to make it possible to run my own website from the usb disk without having to reveal the admin user/pw. And keep the asus GUI alive.

I can't imagine OLEG or antiloop (or U) don't have an answer for this ;-) keeping in mind I'm not a linux guru .

Oleg
21-05-2004, 14:02
Compile separate http server and use it. :)

sauger
26-05-2004, 21:56
Hi,

first: special thanks to Oleg and your firmware releases!

Second: My Problem :/

I tried to run httpd with my own configuration but all I got is an "err error" message.

my (very simple) httpd.conf:
Port 80
ServerType standalone
ServerRoot /mnt/usbfs/web

where /mnt/usbfs is a fat32 partition on an USB stick, which ist writable and readable

when I start httpd via:
killall httpd && httpd -c /mnt/usbfs/httpd.conf
I got these "err error" messages...

Any ideas?

Thanks in advance
Martin

ronin
28-05-2004, 01:03
Oleg,

What I actually want is the GUI for maintanance on the router on port 8080 and a www dir with website on my USB HD available for everyone (running busybox_httpd).

any help on setting this up? and iptables?

thank you

Ronin

sauger
28-05-2004, 08:21
Excactly the same problem here! :)

Oleg
28-05-2004, 10:38
Guys, I've no experience on running busybox httpd. Sorry.
If you want to share /mnt/usbfs you should probably launch it like this:


busybox_httpd -p 9000 -h /mnt/usbfs

and the you should be able to access it from the inside like this: http://my.router:9000/
To open it to a WAN you should add this line to your firewall scripts:


iptables -I INPUT -p tcp --dport 9000 --syn -j ACCEPT


Hope this helps.

ronin
28-05-2004, 12:55
Oleg,

Thanxz a lot!!! that's what I meant! now maybe I can run my webcam.asp and make it available for everyone!

you r the master ;-)

sauger
28-05-2004, 22:39
Thx Oleg, but another little question:

I want to run my webserver on port 80 an the "normal" httpd on another port. So my question is, where to set the port of the standard httpd?

Thx,
Martin

Oleg
29-05-2004, 10:09
I have no idea. You may need to try running it with -p switch.

sauger
30-05-2004, 20:14
unfortunately the -p switch does not override the httpd standard port (80) setting :/

(I changed the httpserver script in /init )

ronin
30-05-2004, 22:35
what is it that u changed to the script? and where?

sauger
31-05-2004, 10:21
This:


cd /web
if [ -f "/etc/linuxigd/WAN_IF" ]; then
. /etc/linuxigd/WAN_IF
httpd -p 8080 $WAN_IF
else
httpd -p 8080
fi


But with no effect :/

alpha5
17-06-2004, 20:47
Nobody found a souloution??

Styno
07-08-2004, 19:41
Guys, I've no experience on running busybox httpd. Sorry.
If you want to share /mnt/usbfs you should probably launch it like this:


busybox_httpd -p 9000 -h /mnt/usbfs

and the you should be able to access it from the inside like this: http://my.router:9000/
To open it to a WAN you should add this line to your firewall scripts:


iptables -I INPUT -p tcp --dport 9000 --syn -j ACCEPT


Hope this helps.I know its an old topic, but I believe there is an tiny error in the iptables command, I think it should be:


iptables -A INPUT -p tcp --dport 9000 --syn -j ACCEPT

This one works for me.

Styno
22-08-2004, 00:35
I've discovered how to use busybox_httpd to execute bash scripts as cgi-bin:

When a subdirectory named 'cgi-bin' exists in the webroot then all files can in that directory can be executed.

So, If my webroot is: '/mnt/usbfs/wwwroot' then the cgi-bin directory is: '/mnt/usbfs/wwwroot/cgi-bin'.

When you want to execute a cgi script you have to call, for example, the following url: 'http://my.router:9000/cgi-bin/iptraffic' where iptraffic is the bash script which generates the html code sent to my browser.

ronin
22-08-2004, 12:32
did you change anything to the rights of the directory? I created the dir placed a .pl and called in in my browser. it says file does not exist.

WlanMan
22-08-2004, 13:43
Hi

He clearly said "Bash-Scripts" meaning you can execute programs and commands from the firmware to generate dynamic content, there was nothing said about PERL :rolleyes:.
And indeed, i think they have to be chmod +x to be executable.

Styno
22-08-2004, 14:17
wlanman is correct:
- Only Bash scripts work (perhaps Perl scripts do work but Perl is not on the router by default).

- Scripts in the cgi-bin directory have to be executable otherwise the browser returns inet error 404 (page not found).

Below is an exampe script:



#!/bin/sh
echo "Content-type: text/html"
echo ""
echo "<html>"
echo "<title>Hello world example</title>"
echo "<body>"
echo "<h1>Hello world</h1>"
echo "</body>"
echo "</html>"

ronin
22-08-2004, 22:57
hmmmm my mistake, srry........but what can you actually do with it then? Have any usefull examples?

Styno
23-08-2004, 00:42
Yes

- there is for example the iptraf script (do a search on iptraf).
- I use a bash script to provide a simple webinterface on top of my ftp server. It shows all directories ordered on datetime so that anyone can see easilly if there are new files on the server.
- In theory you can write the entire configuration webinterface for this router in bash scripts if you want (not that it wouldnt be easy though).
- And all other dynamic pages you might come up with

Below is a simple script:


#!/bin/sh
echo "Content-type: text/html"
echo ""
echo "<html>"
echo "<body bgcolor="#5555aa">"
echo "this is my dir listing:"
ls -lRt /mnt/usbfs/
echo "</body>"
echo "</html>"

WlanMan
23-08-2004, 03:33
Hehe, fun to play with. This can become quite enjoing ...
This throws out some infos about CPU Cache and Memory usage and shows how to use some tools like grep :cool:.



#!/bin/sh
echo "Content-type: text/html"
echo ""
echo "<html>"
echo "<body bgcolor="#5555aa">"
echo "<hr>"
echo "<b>CPU Cache Hits:</b><br>"
echo "<pre>"
cat /proc/cpuinfo | grep cache
echo "</pre>"
echo "<hr>"
echo "<b>Memory Info:</b><br>"
echo "<pre>"
cat /proc/meminfo
echo "</pre>"
echo "<hr>"
echo "</body>"
echo "</html>"

WlanMan
23-08-2004, 04:39
I have put up two scripts on my Router for testing ...
*out of Work*
( Try it! :) )

ronin
23-08-2004, 05:06
updated ----now it does ;-)


Actually i get page can not be displayed.............. :D

WlanMan
23-08-2004, 05:19
Sry, had not opened the Firewall :cool:
Hmm, no CRLF between the names, after all its a quick hack ;)