lighttpd always shows 403 Forbidden

I've installed lighttpd and termux-services. I've got a basic HTML page at /data/data/com.termux/files/usr/var/www/index.html and have set server.document-root = "/data/data/com.termux/files/usr/var/www/" and server.port = 8080 in the lighttpd.conf When I browse to http://localhost:8080 on the phone, or the phone's IP:8080 on LAN I get "403 Forbidden". That definitely comes from the lighttpd process, as when I sv stop lighttpd then I don't get any response. The files have permissions 644 and all directories back to /data/data/ have permissions 755 with the same username that is running Termux. I've tried using a directory on /storage/emulated/0/www and a directory off home, with the same result. I'm using the Termux packages from F-Droid on an unmodified Google Pixel (so nothing like LineageOS or root or any additions to bypass SafetyNet or whatever, just the phone as Google made it). Any ideas what the permission problem could be, or how to allow lighttpd to serve a basic static page?
Solution:
seems like you need to also put /index.html to the address on your browser
Jump to solution
12 Replies
Mlwls
Mlwls2mo ago
maybe try changing the port to something higher?
SuperNintendoChalmers
Good idea. Unfortunately the same thing happens on port 58080 It feels like lighttpd has no permission to read the files, but I don't know how to troubleshoot that without root, which I don't have
Mlwls
Mlwls2mo ago
same here, but when i try using lighttpd -D -f myconfig.conf it show an unknown error instead.
ted
ted2mo ago
if you're getting an http response at all, your problem is not your choice of port you've successfully made a connection to a server that is actually listening on whichever port
Mlwls
Mlwls2mo ago
ookay
$ lighttpd -f lighttpd.conf
2025-10-20 11:14:52: (../src/src/network.c.640) bind() 0.0.0.0:8080: Unknown error 98
$ lighttpd -f lighttpd.conf
2025-10-20 11:14:52: (../src/src/network.c.640) bind() 0.0.0.0:8080: Unknown error 98
and now i just got those error even without -D
ted
ted2mo ago
yeah, that's a problem with your choice of port
Mlwls
Mlwls2mo ago
ooh ok lemme change it
SuperNintendoChalmers
Running in foreground with lighttpd -D -f /data/data/com.termux/files/usr/etc/lighttpd/lighttpd.conf doesn't give any extra output for me
Solution
Mlwls
Mlwls2mo ago
seems like you need to also put /index.html to the address on your browser
Mlwls
Mlwls2mo ago
so it'll be localhost:8080/index.html
SuperNintendoChalmers
omg you are right thank you I also just found nginx works
SuperNintendoChalmers
Much appreciated, this was driving me nuts! Can also make that expected behaviour in lighttpd like:
index-file.names = ( "index.html" )
index-file.names = ( "index.html" )
Whew, what a trek

Did you find this page helpful?