PDA

Bekijk de volledige versie : lan/wan webserver not working



Cal Cobra
06-02-2005, 22:13
I apologize in advance, I'm a total novice in linux, and sorry for the long post, just wanted to make sure I included enough info.

I have already setup my USB-HD via FTP on my wl500g, running Olegs 1.9.2.7-3c firmware, and it's working fine. I implemented alpha5's detailed how-to from here:

http://wl500g.info/showthread.php?t=1457&highlight=webserver

Followed that, and I believe I have it setup correctly:

[admin@(none) root]$ ls /usr/local/sbin/
post-boot post-firewall

[admin@(none) root]$ more /usr/local/sbin/post-boot
mount /dev/discs/disc0/part1 /tmp/harddisk -t vfat
busybox_httpd -p 81 -h /tmp/harddisk/web

[admin@(none) root]$ more /usr/local/sbin/post-firewall
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 ppp0 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:81
iptables -A INPUT -j DROP

Then entered the following to save the changes:

flashfs enable
flashfs save
flashfs commit

reloaded the router, but I don't see the process "busybox_httpd" (although I do see several httpd processes running?).

If I manually enter:
busybox_httpd -p 81 -h /tmp/harddisk/web

Then do a ps, I see it running:

171 admin 376 S busybox_httpd -p 81 -h /tmp/harddisk/web

Strangly when I check after a reboot, /tmp/usbmount/web is no longer present. If I try to remake it in one shot, I get:

mkdir: Cannot create directory `/tmp/usbmount/web/': No such file or directory

I can remake it, but have to make one directy, cd into it, make the next one, and then cd to it and finally make the web directory, but it's gone again after the next reboot??

From the router log:
Jan 1 00:00:20 kernel: EXT3-fs: unable to read superblock
Jan 1 00:00:20 kernel: MSDOS FS: Using codepage 950
Jan 1 00:00:20 kernel: MSDOS FS: IO charset cp950
Jan 1 00:00:20 kernel: FAT: bogus logical sector size 0
Jan 1 00:00:20 kernel: VFS: Can't find a valid FAT filesystem on dev 08:01.
Jan 1 00:00:20 kernel: FAT: freeing iocharset=cp950
Jan 1 00:00:20 kernel: FAT: bogus logical sector size 0
Jan 1 00:00:20 kernel: VFS: Can't find a valid FAT filesystem on dev 08:01.
Jan 1 00:00:20 kernel: VFS: Can't find ext3 filesystem on dev sd(8,5).
Jan 1 00:00:20 kernel: MSDOS FS: Using codepage 950
Jan 1 00:00:20 kernel: MSDOS FS: IO charset cp950
Jan 1 00:00:21 USB storage: vfat fs mounted to /tmp/harddisk
Feb 6 13:46:49 kernel: VFS: Can't find ext3 filesystem on dev sd(8,6).
Feb 6 13:46:49 kernel: MSDOS FS: Using codepage 950
Feb 6 13:46:49 kernel: MSDOS FS: IO charset cp950
Feb 6 13:46:49 USB storage: vfat fs mounted to /tmp/harddisk/part1


I'm not sure what's going on, even after manually starting 'busybox_httpd -p 81 -h /tmp/harddisk/web', if I try to browse to http://192.168.1.1:81 I get a "404 Not Found The requested URL was not found on this server" error.

Maybe because the /tmp/usbmount/web/ directory is never saved, it just bombs off from there... I dunno.

Any ideas???

TIA
Cal

Oleg
07-02-2005, 11:10
your post-boot & post-firewall scripts should start with


#!/bin/sh

Cal Cobra
07-02-2005, 16:11
Oleg that did the trick. Just one small snafu though, this isn't loading:

busybox_httpd -p 81 -h /tmp/harddisk/web

If I invoke it manually everything's working great.

The file looks correct:

[admin@(none) root]$ cat /usr/local/sbin/post-boot
#!/bin/sh
mount /dev/discs/disc0/part1 /tmp/harddisk -t vfat
busybox_httpd -p 81 -h /tmp/harddisk/web

After adding #!/bin/sh to the post-boot & post-firewall files, I also did:

flashfs enable
flashfs save
flashfs commit

Thanks,
Brian

soukouss
09-02-2005, 01:47
Hi everybody
I exactly have same problems than Cal Cobra:

/tmp/usbmount/web still no longer present after reboot

and if I try to browse to http://192.168.1.1:81 I get a "404 Not Found The requested URL was not found on this server" error message.

I have added #!/bin/sh on both scripts and ran flashfs enable/save/commit commands.

I also can't write on my USB-HDD using samba.

Firmware 1.9.2.7-3b
Thanks a lot for your great job !

packes77
09-02-2005, 10:09
hi,

Sorry for my poor english.

I has got the same problem. in fact, post-boot starts before your usb-drive is mount.

So, you must make a pause before your mount & start your daemond.

see my post-boot:
#!/bin/sh

# On attds que le disk Usb soit monté avt tout

echo boucle attente stupid-ftpd > /tmp/post-boot.log
echo `date` >> /tmp/post-boot.log
echo ftpd non start >> /tmp/post-boot.log
while [ ! -f /tmp/stupid-ftpd.log ]
do
echo ftpd non start
done
echo lancement ftpd perso >> /tmp/post-boot.log
killall stupid-ftpd

stupid-ftpd -f /usr/local/root/tmp/stupid-ftpd.conf

echo boucle attente smb >> /tmp/post-boot.log
echo `date` >> /tmp/post-boot.log
while [ ! -f /etc/smb.conf ]
do
echo smbd non start
done
killall smbd
killall nmbd
rm /etc/smb.conf
cp /usr/local/root/etc/smb.conf /etc/smb.conf
/usr/sbin/smbd -D
/usr/sbin/nmbd -D
echo post-boot fini >> /tmp/post-boot.log
echo `date` >> /tmp/post-boot.log

#Lancement du demon pour web perso
busybox_httpd -p 81 -h /tmp/harddisk/web

soukouss
10-02-2005, 08:42
Thanks a lot packes77 for the fast response.

In your post-boot file, I don't see any mount command line (mount /dev/discs/disc0/part1 /tmp/harddisk -t vfat). Are you running something else?

Where must web files be located ? (I thought it was /tmp/harddisk/web because I run "busybox_httpd -p 81 -h /tmp/harddisk/web")

About Samba, I'm not able to change rights. When I enter "chmod 777 /tmp/harddisk/" nothing happens.
Here is a result of ls -al:
drwxr-xr-x 5 admin root 16384 Jul 26 2004 Tech
drwxr-xr-x 3 admin root 16384 May 31 2004 Video
drwxr-xr-x 5 admin root 16384 Feb 10 02:47 ftp_pub

and my smb.conf file
[global]
workgroup = WORKGROUP
guest account = nobody
security = share
browseable = yes
guest ok = yes
guest only = yes
log level = 1
max log size = 100
encrypt passwords = no
preserve case = yes
short preserve case = yes

[share]
path = /tmp/harddisk

[share$]
path = /tmp/harddisk
writable = yes
force user = admin
browseable = no

Thanks again for your help.

PS: Packes77, tu peux répondre en français ;)

soukouss
11-02-2005, 21:45
Good news!
Samba is running in Read/write mode.

Only have to modify the share with $! Am I so stupid?
I think so ... ;-)

Web server is not running but I'm still trying.

Any ideas?

soukouss
15-02-2005, 19:08
Hello everybody,

Webserver is still not running and I need help ...
I'll try to explain my problem.
Firmware 1.9.2.7-3b.

post-boot file:
[admin@wl500g sbin]$ cat post-boot
#!/bin/sh
mount /dev/discs/disc0/part1 /tmp/harddisk -t vfat
busybox_httpd -p 81 -h /tmp/harddisk/web

post-firewall file:
[admin@wl500g sbin]$ cat post-firewall
#!/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 ppp0 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:81
iptables -A INPUT -j DROP

I also did:
flashfs enable
flashfs save
flashfs commit

busybox_httpd is running:
[admin@wl500g sbin]$ ps -ef | grep busy
504 admin 216 S busybox_httpd -p 81 -h /tmp/harddisk/web

/tmp/usbmount/web folder no longer present after reboot.
If I create this directory and put web files, I still have 404 error on http://192.168.1.1:81

I can post any log which may help you to understand what is wrong.

Thanks for your help.
Soukouss

packes77
16-02-2005, 21:39
Salut Soukouss,

Désolé pour ma réponse tardive mais je rentre de WE.
En effet, je ne monte pas le disk car j'attends que le demon stupid-ftpd (celui du routeur) se lance. & il ne se lance que lorsque le disk est monté donc inutile de refaire le mount.
Après je tue ce demon, & je le relance avec unfichier stupid-ftpd que j'ai modifié pour avoir acces a d'autres rep.
Pareil pour Samba, je preferai avec le partage en RW browsable donc j'ai recupere le smb.conf que le routeur cree & modifié à ma sauce

Mon web est bien ds /tmp/harddisk/web

Tout marche nickel ainsi. Mon dernier pb est que le ftp n'est pas accesible depuis le WAN, je pense a un pb de port FTP virtuel avec le firewall mais impossible de trouver de la doc la-dessus. Si tu as des infos je suis preneur.

A+

soukouss
19-02-2005, 17:31
I have upgraded asus router with 1.9.2.7-3c firmware
Reset Hardware
Reconfigure everything (without using config file)
and same problem: 404 error
index.htm is located in /tmp/harddisk/web

For Packes77: As-tu ouvert le port FTP sur ton modem?

Thanks
Soukouss

packes77
20-02-2005, 12:30
Salut,

Renomme ta page en index.html

A+

Antiloop
20-02-2005, 22:01
WHAT did both of you not understand in the Forum Rules ?


General Matters
• Use the english language at all times.

hereby I close the thread