NOTE: I no longer use DD-WRT and am unable to answer any questions about it.
One thing DD-WRT can do, which is under-stated, is serve web pages (internally) via it’s built-in HTTP server. This post will demonstrate how to set it up with a simple static page which displays “Hello Home!” In another post I’ll show how to make something pretty useful with it. Stay tuned!
Pre-requisites
Before this will work and be of any use, the following must be enabled. If yours are not, enable them, then reboot the router.
a) JFFS. See my post on enabling JFFS if you need help.
b) Web Info Status page.
Storage and Access
After reboot, /www/user will be symlinked to /tmp/www. The static page will be served from this location. The access URL will be: http://router_address/user/static.html
Setup Steps
-Login to the router as root via ssh.
-Change directory: cd /jffs/bin
-Edit the startup script (if you don’t have one, create it – boot_set.sh). Add the following to the start of the file. This will copy the html file from the storage location to the serving location. to the html file we are going to serve:
# Copy static web page to serving location
cp /jffs/etc/static.html /tmp/www/static.html
-Change directory: cd /jffs/etc
-Now create the static page “/jffs/etc/static.html” with vi:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" />
<title>Static Intranet Web Page Test</title>
</head>
<body>
<h3>Hello Home!</h3>
</body>
</html>
-Login to the routers web admin page and navigate to Administration > Commands.
-Enter “/jffs/bin/boot_set.sh” in the Command Shell/Commands section.
-Click the “Save Startup” button.
-Reboot by navigate to Administration > Management and click “Reboot Router” from the web interface.
Test
At this point the URL should be available and you should be able to bring up the page from a browser: http://router_address/user/static.html
Stay tuned to see how you can utilize this in a very useful way!
w
I am very happy you wrote up a couple of these articles. I was having some issues myself with getting DNS working so I could call my machines via their hostname rather than needing to know their ip addy’s. I was also happy to see you had a nice write up on using JFFS2 and even how to set it up and serve content from the router.
One issue I had when setting this up is that DD-WRT would not run the ‘boot_set.sh’ file. I actually tried running this file from ‘Administration > Commands’ by clicking on ‘Run Commands’ and I received a ‘Permission Denied’ message. I ended up going back my ssh window and setting ‘chmod +x boot_set.sh’ and then rebooted the router. Everything started working as normal. Once I set the file as executable, all was good. You may want to add this into your step-by-step.
I have one other issue as well. try as I might I can’t seem to get the IP Information to appear when editing the webpage to show the Static/Dynamic ip’s used on my network. I’ve double checked the code I’ve written versus what you offered and there’s no difference. I will go over this a bit more before I bug you again about ti.
Anyway, nice write-up and hope to see you offer up some more ‘how-to’ articles.
Thanks,
c0p…
Thanks for the comment. I see a lot of views of the DD-WRT posts. For the execution privs, that may vary by firmware version. This post was written a couple of years ago and may be slightly out of date with newer releases. Looking at the latest is something I need to do, but I no longer have a test router.
For the names not showing up. The only ones that will populate automatically are the ones DD-WRT issues DHCP addresses for. The static ones are in a file you create /jffs/www/hosts. The boot script copies (builds) this file into one of the html files (hoststat.htm) in the web servers hosting location (/tmp/www) so that its available to serve.
This post talks about serving the locl IPs via web: https://unfinishedbitness.info/2014/04/14/dd-wrt-web-server-for-viewing-all-network-ips/
Hi and thanks for the post. I’m using now this built-in server which is working fine except one issue: SVG images cannot be accessed anonymously, so I have to log in every time. Unfortunately this is the root account, so I don’t want to give the password to somebody else. File permissions are the same for all files, so I suppose it’s the httpd configuration. Any chance to tune this here?
Thanks!
Sorry for the delayed repsonse. I havent used DD-WRT for a few years now. Maybe check the permissions on the files and ensure the web server user has read access. Beyond that I’m not sure.