Log in

Bekijk de volledige versie : Webserver not on port outside:80



void
16-01-2006, 21:18
Hi,
I am trying to get my WL500G running a webserver on a 128Mb stick.
I flashed to oleg latest (7-7) and have installed ipkg and the php-thttpd webserver using the macstat tutorial. Now the webserver is working, but I can't get the webserver to serve on the outside.

So, 192.168.2.1:81 serves the test page and 192.168.2.1 shows the WL500 webinterface. When I use my outside IP http://outside I get the WL500G webinterface instead of my own page.

I have WAN access to the webinterface disabled and this is my post-firewall script:

#!/bin/sh
iptables -D INPUT -j DROP
iptables -A INPUT -p tcp --dport 81 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 80 -j DNAT --to-destination $4:81
iptables -A INPUT -j DROP

Enabling a virtual server from the NAT tab, pointing it from 80 to 192.168.2.1:81 does not have any effect.

Surely I am missing something..:confused:

Thanks!

oleo
17-01-2006, 07:38
Use the following instructions. This is different approach without using iptables. Move GUI interface to other port with setting http_lanport NVRAM variable and then run your http server on port 80 as usual. This feature was added in latest 7b Oleg firmware and works for both LAN and WAN at the same time.


http_lanport-mini-howto.txt

This patch enables http_lanport variable to move router Configuration httpd
daemon to port other than standard 80. The main application is to use
builtin http builtin for other purposes. Port 80 can then be used for
servers like httpd, busybox_httpd, thttpd, ... Setup port with eg. nvram set
http_lanport=8008 ; nvram commit


Create Web pages in flashfs:

flashfs enable
mkdir /usr/local/root/www
vi index.html

<html>
<head>
<title>Test HTTP access</title>
</head>
<body>
<h1>My HTTP server </h1>
</body>
</html>


Move config interface to http://192.168.1.1:8008/

nvram set http_lanport=8008
nvram commit
reboot


Manual start http server on port 80

busybox_httpd -h /usr/local/root/www


Start busybox_httpd at boot:

mkdir /usr/local/sbin
cd /usr/local/sbin
cat >> post-boot
#!/bin/sh
busybox_httpd -h /usr/local/root/www
Ctrl-D
chmod +x post-boot
flashfs save
flashfs commit