Installation and Configuration of the Webserver lighttpd for Fonz fun_plug

LIGHTTPD Logo
LIGHTTPD Logo
This tutorial is deprecated and should only be used with fonz fun_plug 0.5!
Please check the tutorial page for updated tutorials on this topic!

The lighttpd daemon is a lightweight web server. Its main task is to respond to HTTP requests. In other words, it allows HTTP clients (such as Internet Explorer and Firefox) to retrieve hyperlinked HTML pages stored on a web site stored on the CH3SNAS.

In terms of complexity, lighttpd lies between the basic GoAhead HTTP server (which comes with the CH3SNAS) and an Apache server.

Contents

Example uses

The lighttpd server allows you to build a web site which is accessible via your local area network (LAN). If you configure your router’s firewall properly, you can also let others access the website via the Internet. Opening your firewall to give access to outside HTTP requests obviously requires paying some attention to security.

A basic web site consists of a collection of HTML pages which provide text, links, images, documents, etc. HTML pages can be written with an ASCII editor. There are numerous books and online tutorials on how to create basic and advanced web pages directly in HTML. This can be worth trying if you want to understand how the World Wide Web works: HTML is the main technology behind WWW.

In recent years, however, the average web page has gotten increasingly sophisticated in terms of its technical and visual design. Furthermore, the content of many web sites has become dynamic: what you see in your browser often changes daily (the weather, the news, a blog, photos). Such dynamic HTML pages are generated (by running programs or scripts) whenever the set of HTML pages needs to be updated, or are created on the fly whenever the server receives a page request.

Some examples of what you can do with a web site consisting of basic, static HTML served via lighttpd:

  • a basic home page telling who you are
  • a set of pages about your hobby, your recipes, or reporting on your holiday trip (all with embedded pictures)

Using this approach you “program” your page using the HTML language.

Examples of ways to generate ”’fancier static HTML”’ pages using software:

  • Microsoft Word can generate a HTML version of a document (including formatting, links and pictures)
  • professional photographers may use Photoshop Lightroom to generate an online gallery of sample pictures

Using this approach you use software to generate the HTML pages. This means you don’t need to learn (much) HTML, but instead need to learn how to use the (often fancy) software. All-in-all this can save you some typing and helps generate a uniform look for the web site.

Examples of applications involving generating dynamic HTML pages:

  • a Blog or Forum contains HTML forms that allow users to type in text that is appended to certain pages. Example: NAS-Tweaks uses a PHP server and software by WordPress for its Blog. Often this approach uses a database like MySQL to store and manage the raw data used to generate the HTML.
  • many well-known Web 2.0 sites that provide a service for you (WikiPedia, Google Maps, YouTube, Flickr)

Using using this approach, software generates HTML pages on demand, keeps the pages updated, and allows interaction with the user. If you go overboard on this, and manage to get the users of your website to provide content which keeps you web site interesting, you can call this Web 2.0 and tell your friends you may become rich – someday.
This kind of software is often known as Content Management Systems and includes engines like Drupal, Joomla, Mediawiki (as used by Wikipedia) and WordPress (as used for blogs).

Setting up Lighttpd

Installation

By default a lighttpd is already installed with the fun_plug packages. But there is an update available. Before you can install it, be sure to synchronize my repository. Then update using the following command:

funpkg -u /ffp/pkg/additional/*/lighttpd-*.tgz

If you didn’t install all packages from the “packages”-directory (why not?), you should execute at least the installation of the OpenSSL-package:

funpkg -i /ffp/pkg/packages/openssl-*.tgz

Directories

The default lighttpd configuration needs a small directory tree where it can store logfiles and retrieve the data to display to the users. Instead of creating the directory at that location, you may prefer to create a symbolic link from /srv/ to the target-directory of your choice.

mkdir -p /ffp/opt/srv/mysql
ln -s /ffp/opt/srv/ /srv

This link will be lost after rebooting the device, so you have to add the following two lines to the end of the file /ffp/etc/fun_plug.init to recreate the link every time the NAS boots. You can edit this file using an editor like nano. Use the following for all NAS other than the DNS-320 or DNS-325:

# create custom link to the server-folder
ln -s /ffp/opt/srv/ /srv

Now create the folders for the webserver:

mkdir -p /srv/www/pages
mkdir -p /srv/www/logs
mkdir -p /srv/tmp

The folder /srv/www/pages is the default location for the web site itself. The location is set via a parameter called server.document-root in the /ffp/etc/lighttpd.conf file. This means that any directories below server.document-root are visible via the HTTP server (careful), while any other directories are not visible.

The folder /srv/www/logs is for log files in which lighttpd can record what happened.

HTML test pages

Within the www folder, you should create a home page named index.html containing the following ASCII text. Note that the indentation is only for readability and can be (and often is) omitted. You don’t need to worry about using Linux or Windows end-of-line conventions here (both work). You may have to adapt the line CH3SNAS:81 to reflect the network name of your NAS or use its IP address instead (e.g. 192.168.0.20:81).

<html>
    <head>
        <title>Hello world</title>
        <style type="text/css">
            <!--
                h1 {text-align:center;
                    font-family:Arial, Helvetica, Sans-Serif;}
                p  {text-indent:20px;}
            -->
        </style>
    </head>
 
    <body bgcolor="#ffffcc" text="#0000ff">
        <h1>Hello, CH3SNAS Tweak'n World!</h1><p>
        <A HREF="page1.html">Link to local page1</A><p>
        <A HREF="page2.html">Link to local page2</A><p>
        <A HREF="http://CH3SNAS:81">Configure the CH3SNAS</A><p>
        <A HREF="https://nas-tweaks.net/CH3SNAS:Tutorials/lighttpd">external link to the Lighttpd tutorial</A>
    </body>
</html>

The HTML code consists of a head and a body section. The head contains the title (shown at the top of the browser window) and, in this case, defines formatting styles for Header1 and new paragraph (<p>).
The body starts with a header, followed by four links (“<A>nchors”) to other pages, to the original HTML configuration page for the CH3SNAS (on port 81 instead of the default 80) and a link to a remote web site.

Then create page1.html in the same directory containing:

<html>
    <head>
        <title>Page #1</title>
        <style type="text/css">
            <!--
                h1 {text-align:center;
                font-family:Arial, Helvetica, Sans-Serif;}
                p {text-indent:20px;}
            -->
        </style>
    </head>
 
    <body bgcolor = "#ffffcc" text = "#0000ff">
        <h1>Page 1</h1><p>
        <A HREF="index.html">Home</A><p>
        <A HREF="page2.html">Link to page2</A><p>
    </body>
</html>

Similarly you can create page2.html in the same directory:

<html>
    <head>
        <title>Page #2</title>
        <style type="text/css">
            <!--
                h1 {text-align:center;
                font-family:Arial, Helvetica, Sans-Serif;}
                p {text-indent:20px;}
            -->
        </style>
    </head>
 
    <body bgcolor = "#ffffcc" text = "#0000ff">
        <h1>Page 2</h1><p>
        <A HREF="index.html">Home</A><p>
        <A HREF="page1.html">Link to page1</A><p>
    </body>
</html>

Enabling lighttpd

This tutorial assumes that fun_plug is installed and that you have installed the additional packages (these include lighttpd). You can test whether lighttpd is installed using

which lighttpd

on the ssh command line. If it is installed, it will respond with the location of the lighttpd script file: /ffp/sbin/lighttpd.

Waking up daemons

Next we need to enable the lighttpd server from the command line (see the packages tutorial for a detailed explanation):

chmod a+x /ffp/start/lighttpd.sh

and enable a script which disables the standard HTML server called webs (if you are running a DNS-320 / DNS-325 please skip this step and go to the following section):

chmod a+x /ffp/start/kickwebs.sh

The standard “webs” server then restarts automatically within a few minutes, but moves to port 81 because the standard HTTP port (80) is already occupied by the lighttpd server.

If you are running a DNS-320 or a DNS-325, you need to enable “kickwebs_dns320.sh” for kicking the internal lighttpd (which is used for the Webinterface of the Device) from Port 80:

chmod a+x /ffp/start/kickwebs_dns320.sh

Note that the chmod commands only take effect on the next reboot. If you would reboot now, however, nothing changes. If you want to try, you can see test this manually using:

sh /ffp/start/kickwebs.sh start # When you run a Device other than DNS-320 / DNS-325
sh /ffp/start/kickwebs_dns320.sh start # When you run a DNS-320 / DNS-325
sh /ffp/start/lighttpd.sh start

Unless you have installed the server before, you will get the error message /ffp/etc/lighttpd.conf: Required file not found or not readable. Which, by Linux standards is an unusually clear error message: a file with configuration settings for lighttpd is missing in the /ffp/etc directory (see the packages tutorial for more explanation).

lighttpd.conf

We can resolve the missing /ffp/etc/lighttpd.conf file by copying the file from the directory /ffp/etc/examples/. If you are not on a DNS-320 or a DNS-325 and you don’t need PHP, then run the following command:

cp /ffp/etc/examples/lighttpd.conf /ffp/etc/

This copies one of the two supplied configuration files from the /ffp/etc/examples subdirectory to the /ffp/etc directory.
if you want to run PHP and you are not on a DNS-320 or a DNS-325, then run the following:

cp /ffp/etc/examples/lighttpd.conf-with-php /ffp/etc/lighttpd.conf

If you are on the DNS-320 or DNS-325, you have no choice but to run the Webserver with PHP (Please configure PHP before you try starting lighttpd again!):

cp /ffp/etc/examples/lighttpd.conf-dns320 /ffp/etc/lighttpd.conf

Port insight

Next we can try starting lighttpd manually again to see how we are doing:

sh /ffp/start/kickwebs.sh start # When you run a Device other than DNS-320/DNS-325
sh /ffp/start/kickwebs_dns320.sh start # When you run a DNS-320 / DNS-325
sh /ffp/start/lighttpd.sh start
sh /ffp/start/lighttpd.sh status

Example HTML page being hosted by Lighttpd
As, this suggests that lighttpd is now happily running, we try typing http://CH3SNAS:81 in the address bar of your Web browser. Note that if your network name for the device differs from “CH3SNAS“, use that name or its IP address instead. You should now get the standard configuration screen. Please remember the :81 port number in case you need to access it in the future (it is one more than the standard port 80 used for HTTP servers – which you can look up on the internet). You can close that screen – it was only to demonstrate that kickwebs.sh did its job.

We now try entering http://CH3SNAS in the address bar of the Web browser. If all goes well, you will see the expected web page.

To boot or not to boot

Remember that you now have a lighttpd running on port 80 each time you boot the NAS. If you want to connect to the Webinterface of the NAS, connect to Port 81.

Testing Lighttpd

At this point, you can enter any of the following into your browser’s address bar (assuming CH3SNAS is the correct network name of your NAS):

  • http://CH3SNAS:80/index.html
  • http://CH3SNAS:80 – index.html is a default for browsers
  • http://CH3SNAS – port 80 is default for HTTP
  • CH3SNAS – http is the default protocol for web browsers

Notes

The log files

The directory /srv/www/logs contain log files which respectively record the access to the server and any errors (including starting and stopping) reported by the server.

-rw-r--r-- 1 root  root    0 Oct 19 17:06 access.log
-rw-r--r-- 1 root  root   48 Oct 19 17:06 error.log

The file access.log contains timestamped records which are appended whenever a file on the server is accessed via HTTP (which file, which IP address, HTTP statuscode, browser used). Here is a schematic line from the access.log file:

client_IP server_URL - [date:time +0200] "GET /path/file_1.jpg HTTP/1.1" status_code file_length "-" "client_browser_type"

If you want to clear the log files, one quick-and-dirty way to do so is to delete them and restart the CH3SNAS. The lighttpd server will regenerate the log files when it is started. A quicker approach is to restart the lighttpd server using:

rm /srv/logs/access.log
cd /ffp/start
sh lighttpd.sh restart

Now What?

You should now install PHP if not already installed and try using MySQL. Have fun 🙂

95 thoughts on “Installation and Configuration of the Webserver lighttpd for Fonz fun_plug”

  1. Hi! I’d like to thank you for your work helping us to get more from our devices. I followed this tutorial as close as I could and now my web server is up and running on my dns-320. Unfortunately the admin page is lost until I stop lighttpd. It seems that kickwebs didn’t do the trick for me. Any suggestion will be appreciated. Thanks.

    1. Hello fpo,

      sorry yes, i wrote the tutorial before the dns-320 was on the market. Kickwebs doesn’t do the trick as d-link is already using a lighttpd for the configuration. I will take a look at this.

      Cheers,
      -Uli

    2. I have the same problem with my DNS-320. Simply changing killall webs to killall lighttpd wasn’t enough, since the lighttpd.se start command seems to start the built-in lighttpd instead of /ffp/sbin/lighttpd… Changing the name variable in /ffp/start/lighttpd.sh (to lighttpd2 for example) seems to not start /usr/sbin/lighttpd, but not /ffp/sbin/lighttpd either…

      I’m at a loss and really need some help!

    3. Just few more details on automatic startup: To start the custom lighttpd in boot time on dns-320, we need to stop the built-in server first, otherwise the script thinks the server is already started and does nothing. I have added this code to /ffp/etc/fun_plug.local

      PATH=/ffp/sbin:/ffp/bin
      /ffp/start/lighttpd.sh stop

      and everything works fine.

      1. Not working for me.

        root@dlink-FFB07D:~# ps aux |grep light
        10018 root /usr/sbin/lighttpd-angel -D -m /usr/local/lib -f /etc/lighttpd/lighttpd.conf
        10019 root /usr/sbin/lighttpd -D -m /usr/local/lib -f /etc/lighttpd/lighttpd.conf
        10061 root grep light

        root@dlink-FFB07D:~# PATH=/ffp/sbin:/ffp/bin

        root@dlink-FFB07D:~# /ffp/start/lighttpd.sh stop
        Stopping lighttpd

        root@dlink-FFB07D:~# ps aux |grep light
        10071 root grep light

        root@dlink-FFB07D:~# /ffp/start/lighttpd.sh start
        Starting /mnt/HD/HD_a2/ffp/sbin/lighttpd -f /mnt/HD/HD_a2/ffp/etc/lighttpd.conf
        root@dlink-FFB07D:~# ps aux |grep light
        10088 root grep light

        and, ofcourse:


        root@dlink-FFB07D:~# /ffp/sbin/lighttpd -t -f /ffp/etc/lighttpd.conf
        Syntax OK

        1. So if started manually it works, but not at boot time? This is what worked for me: create fun_plug.local script with the above mentioned commands, make it executable, disable kickwebs.sh (if modified to kill lighttpd) and enable lighttpd.sh in /ffp/start – that is all, as far as I remember (except for modifying lighttpd.conf to handle the administration, which should not be the problem here).
          If not working, try to redirect /ffp/start/lighttpd.sh stop in fun_plug.local to a log file to see if it has done its work.

          1. No, as you can see from the output of the last ps aux | grep light, there’s no lighttpd running. The first one is the firmware one, and not the /ffp/sbin/ one..

            So, I can’t even manually start my server!

        2. Whoops, missed it… Unfortunately I do not know where the problem is. But our systems seem to be configured differently, as for me it gives:

          root@sharecenter:~# /ffp/start/lighttpd.sh start
          Starting /ffp/sbin/lighttpd -f /ffp/etc/lighttpd.conf

          1. I came to the conclusion that the conf file had some problem in it, even though it said “Syntax OK”. So I copied /etc/lighttpd/lighttpd.conf to /ffp/etc/lighttpd.conf and that worked! Then I changed the port, added my awesome iPhone API stuff, and everything is up and running now! 🙂
            Next up: an extra layer of authentication!

  2. The custom lighttpd can handle the built-in administration, just set the document root for desired port:
    $SERVER["socket"] == ":80" {
    server.document-root = "/var/www/"
    }

    and add some directives to handle cgi etc. (you can copy them from /etc/lighttpd/ligttpd.conf).
    It seems the server must be run as root for some administration functions to work, but as it refuses to accept server.username = “root” directive, removing server.username and server.groupname from the config file and leaving the server just be started under the root account will do it.

  3. Port 80
    The example config files start lighttpd on port 8080, because the default HTTP port 80 is used by the administration interface (goahead web server). Using a little trick, you can move goahead to port 81 and run lighttpd on port 80: http://forum.dsmg600.info/t246-Change-http-port.html

    To setup your lighttpd for port 80, disable the server.port directive in lighttpd.conf, and activate the kickwebs.sh and lighttpd.sh start scripts:

    cd /ffp/etc
    sed -i ‘/server.port/ s/^/#/’ lighttpd.conf
    cd /ffp/start
    chmod a+x kickwebs.sh lighttpd.sh

    After reboot, lighttpd should run on port 80. To manually activate the changes, run (in quick succession):

    cd /ffp/start
    sh kickwebs.sh start
    sh lighttpd.sh restart

    Note that the above will kill the goahead web server process. It will restart automatically, but this may take a few minutes.

    This is from the DNS323 wiki. http://dns323.kood.org/howto:ffp#lighttpd_web_server

    1. But that doesn’t apply to the DNS-320 🙂 What you are describing is already contained in the Tutorial. Thanks anyway!

      Cheers,
      Uli

      PS: To all others: I think have the solution, i’m also compiling lighttpd 1.4.28 at the same time so that it does make sense to have a new package 🙂

    2. Hi there … I am having a similar problem using the DNS-325 NAS.

      In short I need to have lighttpd on port 82 (I use a domain redirect so accessing my web site does not require http://www.xxx.com:82 and I use xxx.dyndns.org for my router), the NAS config and http on port 80, and leave port 81 reserved for php or something else.

      I NEED to keep the NAS on port 80 so I can use the ‘photo center/gallery2’ and ‘ajaxexplorer’ addons to work on port 80 while also keeping the NAS config on port 80 (changed to port 81 after installing lighttpd) while also allowing a web server to work on the NAS.

      I have modified the lighttpd.conf file for …

      lighttpd server.port = 82

      and

      $SERVER[“socket”] == “:80” {
      index-file.names = ( “web/login.html”,”index.php” )

      for the NAS config on port 80.

      I have have disabled kickwebs.sh (confirming in the log file it has not started with lighttpd starting) YET something on reboot of the NAS keeps or enforces no change AND lighttpd remains or has reverted to port 80 and the NAS remains on port 81.

      In following the various posts and instructions, there are few that discuss this similar dilemma, but only seems to hit around it without any resolve.

      I have seen such describe defaults for lighttpd on port 8080, but I did not see this in my installation. Additionally, the discussions indicate the file lighttpd.conf in /ffp/etc/lighttpd while mine is in /ffp/etc … do I need to add an additional folder as a directory is not being properly referenced.

      Really appreciate any help on this and many thanks in advance.

  4. The new packages lighttpd-1.4.28 and php-5.2.17 are pushed to the repository, the post is updated for the DNS-320. Have fun 😉

    Cheers,
    -Uli

  5. Hello! I appreciate the support we’ve got from your website. Now everything is working as expected. I had to install openssl to get it work.

  6. Hi there, thanks for your informative guide, Uli!

    I am struggling with my DSN320. I presume it’s something I’ve done wrong as others here are okay. Essentially I’ve installed the lighttpd and php packages but after running the 320-specific kick script then starting

    sh /ffp/start/kickwebs_dns320.sh start
    sh /ffp/start/lighttpd.sh start

    I find just the inbuilt web server has started up:
    4397 root /usr/sbin/lighttpd-angel -D -m /usr/local/lib -f /etc/lighttpd/lighttpd.conf
    4398 root /usr/sbin/lighttpd -D -m /usr/local/lib -f /etc/lighttpd/lighttpd.conf
    4399 root /usr/bin/php-cgi

    What do you suggest I check to debug this problem? Thanks guys..

  7. Yep, all directories created and OpenSSL on as I’m using putty to connect..

    I followed the guide all the way through and everything seems to work until the bit where I try to connect on port 81 – I don’t have anything listening on port 81, just the normal admin site on port 80. There are no logs. In case it’s relevant I do have Twonky server running, as per your guide.

    Could I start lighttpd with a switch to suggest debug mode or additional logging?

  8. Hi Uli,

    In case it’s relevant, I notice I do have the two instances of lighttpd running, one called “-angel”. Is this the built in admin version?

    root@MEDIASHARE:/mnt/HD/HD_a2/srv/www/logs# ps -ef | grep lighttpd
    11883 root /usr/sbin/lighttpd-angel -D -m /usr/local/lib -f /etc/lighttpd/lighttpd.conf
    11884 root /usr/sbin/lighttpd -D -m /usr/local/lib -f /etc/lighttpd/lighttpd.conf

    1. Hello Sam,

      sorry for not answering.

      I will write a Script for the initial installation of lighttpd which creates the directories and checks if everything is installed correctly. Unfortunately the Server doesn’t tell much. Maybe it tells you the error in /srv/www/log/error.log?

      Regarding your second question: lighttpd-angel is a process for gracefully restarting the lighttpd (See announcement), so this needs to be there 🙂

      Regards,
      Uli

  9. No need to apologise, any help and suggestions are really appreciated, many thanks!

    Nothing in the logs folder. So am I understanding that I only have the built in webserver running? I note that the process I have running references:

    /etc/lighttpd/lighttpd.conf
    and not:
    /ffp/etc/lighttpd.conf

    If I am successfully in following your guide, should I see two instances of the process, one with the /etc config file and one with the /ffp config file? Or does the new instance of lighttpd take responsibility for the admin site too (albeit on the different port etc).

  10. Well I don’t know what I did, changed a hundred things, but it now works, so err, thanks!! Great guides and keep up the good work.

    1. Sam,
      Im having the same trouble you described. port 81 and 80 both redirecting to the normal admin site.
      Ive install both PHP and lighttpd following the guides as above.
      I do notice though, that when i run the index.php site from the drive manually, it doesnt give the table of info.
      What did you do to fix the problem?

      Steve

      1. forgot to add i get this:

        root@DLINK320:~# ps -ef | grep lighttpd
        2543 root /ffp/sbin/lighttpd-angel -D -f /ffp/etc/lighttpd.conf
        2544 root /ffp/sbin/lighttpd -D -f /ffp/etc/lighttpd.conf

          1. Precisely what happened to me Steve, and mine also “resolved itself”, although to be honest I fiddled about so much I don’t know what I did to fix it, if anything. One comment I’d make is that lighttp does seem to take a fair while to restart so be aware of that if you’re making changes. Now does anyone fancy helping me get Openvpn working?!!

          2. Well, same here, I have installed PHP and lighttpf as in the guides, and no redirecting into 81 port, always cames to the 80 port. Have make it to wait to “autoresolve”, but no luck. It seems yo also touched anything guys, and I cannot figure out what.

            Ligth is running, seems killing script is working, but just it. Still trying to figure out the problem.

          3. Hi,

            I have DNS-320.
            I followed the guide.
            lighttpd is working

            When restarting server, in the ffp.log

            WARNING: lighttpd: Already running

            root@DLINK320:~# ps -ef | grep lighttpd
            1330 root /usr/sbin/lighttpd-angel -D -m /usr/local/lib -f /etc/lighttpd/lighttpd.conf
            1721 root /usr/sbin/lighttpd -D -m /usr/local/lib -f /etc/lighttpd/lighttpd.conf

            I don’t understand what to do to make my second personal lighttpd working

            Do you have any suggestion ?

  11. I have a dns-320 and, as you guys say, it uses lighttpd already, so I was thinking isn’t it possible use it to serve my own html/php files? Say, put my files in a folder anywhere on the mounted drives and put a symlink inside the built-in lighttpd webroot folder.

    1. I tried this, but the built-in is located in read-only firmware (probably a good thing…), so you can’t create a symlink to the mounts.

  12. Hello,
    I am lost I want to know how to create a link on my video are different on my hard drive because every time I mark his 404 not found if I made ​​a link elsewhere than on the record or are storing web pages and if I change the root server nothing appears please help me

      1. Sorry, I’m French and I use a translator to speak,
        I just wondered, how do I create a hyperlink on a web page to point to a file different than those stored in the folder www / pages

        ex: I have a video file in the Shares folder, for example, and not in the folder www / pages so I create my link in my web page video 1 , but his references to me 404 not found message, I would like to know how to prevent it thank you enormously in advance and sorry for the rotten English

  13. Port configured for lighttpd is 8080 not 80 as it says in the instructions. Standard DNS-323 web server remains on 80. Index.html also need changing to match. Works like a dream.

  14. Finally found that only default server is running:

    root@CASANAS:/mnt/HD/HD_a2/ffp/home/root# ps |grep light
    3907 root /usr/sbin/lighttpd-angel -D -m /usr/local/lib -f /etc/lighttpd/lighttpd.conf
    3908 root /usr/sbin/lighttpd -D -m /usr/local/lib -f /etc/lighttpd/lighttpd.conf
    4270 root grep light

    so it is evident no /ffp lightserver is working. I have tried many things, but still no luck. This goes on slowly, but keep trying…

    1. Solved, the problem was with the link (ln -s …), so after redoing it, web server is up and running. you should restart server AFTER applying linking, or it wont work.

      Now I am trying yo create some sort of https website.

      Thanks!

        1. ln -s /ffp/opt/srv/ /srv

          After rebooting, unless you modify also the fun fonz init file (i do not really know why didnt did in dns320) link to that folder isnt present anymore, so you should restart it again.

          I had to do it twice till finally i got it.

          Now I am dealing with ssl support, to make login over internet safe, but at the moment not succeed.

          morg

  15. Hi.

    I have installed and Configurated lighttpd and php for Fonz fun_plug, and it runs perfect.

    At home my ip is dinamyc.

    Could I use ez-ipupdate to update a DDNS service ?

    How should I do it ?

    Thanks in advance.

    1. You can use the update-Function in the Webinterface 😉 Most of the Devices can do that by default otherwise your router could do it.

      Cheers,
      Uli

  16. Hi, i have a question regarding openssl. I have openssl installed via optware because it is required for cups print server. Do I need to install the funpkg version of openssl? Or will the optware version suffice to use ssl with lighttpd? (iirc, the optware version was a little newer?) Or should I install the funpkg version of openssl too? (Will it matter if I have two versions of openssl installed? Conflicts?)

  17. Hi,
    followed the steps above
    but after
    # sh /ffp/start/lighttpd.sh start
    # sh /ffp/start/lighttpd.sh status
    I get
    lighttpd-angel not running

    in the /srv/www/logs/error.log
    (mod_fastcgi.c.1104) the fastcgi-backend /ffp/bin/php-cgi failed to start:
    (mod_fastcgi.c.1108) child exited with status 2 /ffp/bin/php-cgi
    (mod_fastcgi.c.1111) If you’re trying to run your app as a FastCGI backend, make sure you’re using the FastCGI-enabled version.
    If this is PHP on Gentoo, add ‘fastcgi’ to the USE flags.
    (mod_fastcgi.c.1399) [ERROR]: spawning fcgi failed.
    (server.c.938) Configuration of plugins failed. Going down.

    please help,
    I’m a dummy in linux, so please give the answer in clear text
    (dns323, firmware 1.08)

  18. lighttpd-angel not running

    I get this error.

    Previously i have runned the server perfect. But now, after install transmission and mldonkey the server doesn´t work

    I need your helkp.

    I use port 80, 81 8080 … i don´t know how to do.

    Thanks in advance.

  19. Hi,
    I followed this excellent tutorial to install lighttpd (with php) on my NAS-320.
    It works fine but I’ve a trouble with GD extension.
    phpinfo() returns nothing about GD and gd_info() doesn’t work.
    In log file I can see error when I try to use GD function (undefined function), but there’s no error when server starts.
    Does someone already notice this issue or can try function phpinfo() to check if it’s the same ?

    Regards
    Bat

      1. Hi Uli,thanks for your answer.
        Yes, I used your repo.
        I just reinstall all by following your procedure, but the issue still remains.

        Just to be sure, GD works on your nas ?

        Regards
        Bat

        1. I ran into the same problem, this post may be 3 months old but I though to reply anyway in case someone else needs the solution:

          Please try changing the extension_dir in php.ini to point to the location of gd.so; in my case, it needed to be changed to:

          extension_dir = "/ffp/lib/php/extensions/no-debug-non-zts-20060613/"

  20. Hi, my name is Jose, I am from Spain so please be patient with my English, I will try to do my best.
    I have a DNS-323, I just started to install ‘fonz fun_plug’ and as fas as I know everything has gone well, I didn’t get any error.
    Right know I have finished to install the lighttpd and that’s why I am writting this message.
    It is supposed that my ports has changed from 80 to 81 (I mean to connect the standard configuration screen) and I will enjoy my new web server on 80. But nothing at all has happened in that way.
    I still have the configuration screen in 192.168.1.11 as always (wich is my local ip for the NAS), even I have rebooted the system.
    Althought, I created the three files; index, page1 and page2.html as the manual indicates me and located them into /www I can not reach them, of course.
    Does anybody know what was wrong? I had read very carefully all the steps many times and I think I have not forgotten any of them.
    It is like ‘sh /ffp/start/kickwebs.sh’ were not doing its job.
    Thanks for your help.
    I will be looking for an answer.
    Kind regards.
    Jose.

  21. Hi, I’m using D-Link DNS-325.
    I sucessful get work lighttpd and php on port 80.
    NAS webtool is on port 81.

    But when i try log in there is page not found error. However when i check ssl connection it works fine.

    I did everything by this instructions. Can u help me?

    Btw is it possible just let NAS webtool on port 80 and run www on other port?

    Sry my bad english and thx for any help.

  22. I have lightppd with php on port 8080, it works fine. But after NSA210 reboot, its administration on port 80 doesnt work. I tried 80,81,8081 but allways Page not found. I have FFP installed on flashdisk, HDD (samba) works. What shoud I do for NSA210 administration webpage works?

  23. I hard-reseted NSA210, administration worked. I inserted flashdisk with FFP (configured lighthttp with php), both worked. After restart NSA210 lighthttp with php works, but nasbox administration doesnt work on 80 (8081- my alternative port for administration, 81, 8080). Any suggestions to make administration run?

  24. Hello All,
    I have DNS-320 and I think I finally could switch the device http server to port 81 but now I see the front login page but cannot log on… I’m getting HTTP 404 “page not found” error! The accessed http page is : http://DNS320:81/cgi-bin/login_mgr.cgi
    Can somebody help…please?

  25. So how do you upload files to the www folder? When I try browsing to my DNS-320 in Explorer i get Access Denied trying to copy files to it.

  26. Hi Uli,

    By mistake I erase the original file lighttps.conf in the directory /etc/lighttpd of my DNS-320. Could you send to me the original file.

    Thank you in advance.

    Luis Marquez

  27. Uli, thank You very much for your quick answer. My nas works again.
    best regards and merry christmas.

  28. Sorry for the newbie question, my linux is a bit rusty from disuse.

    I have a DNS-320, but I would like to be able to serve files on the Volumes over http.

    I would also like to leave the built-in configuration panel as is. It sounds like the 320 runs these panels on lighttpd – is there a way to point to the Volumes so that the files are accessible?

    1. Great, I got it working! Thanks for these instructions.

      I had a couple of issues with the DNS-320 common to people here, such as the admin panel still coming up on port 80.

      The built-in webserver appears to be on a watchdog and will auto-restart after a few moments of being shut down (if no other lighttpd takes its place). If there is a problem in the configuration of the ffp/ server, it will not start and thus the built-in will restart.

      If you do a ps -a, you’ll see that the lighttpd is the built in one running from /usr/sbin and not /ffp. This is what causes the admin panel to come up on port 80.

      I solved this issue by making sure OpenSSL was installed. This did not require any further configuration.

      Also, I had to create ln -s /ffp/opt/srv/ /srv before shutting down built-in and starting my own.

      One last thing I did was enable virtual directory listings in lighttpd.conf – Roksbox on my Roku needs these to populate its list of media available.

      I added ln -s /ffp/opt/srv/ /srv to my fun_init so that the ffp server would start on boot, but it does not seem to take?? I will research this further. For now, when the DNS-320 is restarted I must login to it and do this and restart the server manually.

      1. And after taking a 30 minute break, the ln -s took on a reboot! I made no other changes other than adding an echo to fun_plug.init to be sure it really was executing.

        1. Hello Craig,

          I have DNS-320 and trying to link roku, roksbox with my NAS. I did go through the whole setup as mentioned. All went well. The challenge is
          When I enter 192.168.0.100:80, it takes me to the default login screen but would not login. But if I enter 192.168.0.100/index then it takes me to the custom index screen

          So is there a problem here?. Also I am a real beginner on linux, could you please tell me how to create the web server address for roksbox to map to my media folder?.

          I need to thank Uli, since this is simply great. Even I could do something means it was very well guided.

          Regards

          Jay

          1. Are you using the special DNS-320 configuration for lighttpd? Did you modify it?

            Once I verified that 80 was the custom server and :81 was the admin panels, I pointed my documentroot for port 80 to /mnt/HD/HD_b2 (volume 2) where my media is stored. Of course, you may have some other system of organization. One key to getting Roksbox to work is that Virtual Directories must be enabled. Those are the only changes that I made to the DNS-320 lighttpd config

            Be sure to restart lighttpd after you make changes.

  29. Hello Craig,

    Thank you so much. This is working like magic. Thanks to all who has done this website. This is the first time I am doing something on linux and presto here we go all working extremely well.

    Thanks Uli, Craig for all the help.

    Wish every one a very propsperous new year.

  30. Maybe I’m wrong but I think the command
    ln -s /ffp/opt/srv/ /srv
    should be
    ln -s /ffp/opt/srv/ ./srv
    otherwise the link directory is made in himself instead of the root.

    1. Hello Gauthier,

      unfortunately you are wrong, the Directory is created in root when the command ends with /srv

      Cheers,
      Uli

  31. I’ve been trying to setup my DNS-320 to work with RoksBox as well but to no avail. Can someone put together a Tutorial/Guide for this? Also, does anyone know the file size limit for Lighttpd that could be streamed with RoksBox? I heard someplace that Lighttpd is limited to 2GB.

  32. I have successfully installed php Lighttpd end I can see the pages in php mysql in php.ini but I was ok as described but I tried to install joomla mysql support there help me? thanks

  33. Hi there,
    First of all, sorry for my english and many thanks for all you are doing on this topic.
    It’s been a long i’m trying to run lighttpd.
    I followed this tuto and here is my problem on a dns-325.
    When I point on ipadress of my NAS, the login page appears. I enter my login and password and after that I have a “404-Not found error”.
    It’s the same on port 80 and 81.
    I don’t know from where I have to begin to analyse the origin of my problem.
    Is there a mistake in a conf file? (funplug, lighttpd or whatever)
    Do I have to place this 2 lines in the fun_plug.init file? (# create custom link to the server-folder
    ln -s /ffp/opt/srv/ /srv)
    Do I have to change something in the conf files?
    If you need further information, please let me know and the way to get them, linux is new for me.
    Many thanks in advance

  34. Hi there again,
    Now it’s better. I can access the server but if I want to access the configuration page of the NAS with port 81, I get the login page, but after that, error 404 occurs.
    Any idea?

    Many thanks

  35. For those who were getting the “404” after logging into the Dlink Admin on the DNS-320:-

    I can visit http://server:81 to get to the admin, (and http://server to get to my own page) but then logging in indeed gets me the “404” message. However, the site it’s gone to on login is http://server/web/home.html – if I browse to http://server:81/web/home.html, then it works, and remembers the :81 as I navigate round the admin site.

    Would like it if it worked this out automatically, but it seems fine once I’ve told it once. I wonder if it’s a browser issue? (Firefox 10)

    Thanks for the work on this – makes the NAS a whole lot more useful.

  36. Hi! Really thanks for this great job.
    I have a problem, I cant find neither kickwebs_dns320.sh nor sh /ffp/start/kickwebs_dns320.sh start so I can not change the port of my web server.
    What can I do?

    Thanks!

  37. Hello,
    I have funplug 0.7 installed on a DNS 320. No kickwebs_dns320.sh nor php_dns320.ini.
    Can somebody help me to make it work with ffp 0.7 please?

  38. Hi! Could you please write a lighttpd/php/mysql guide for fun_plug 0.7? I have tried to get it to work using the old guide and google but it’s just hopeless.. I got a dns-325 btw.

  39. +1 to Jacob’s comment

    please can you provide a tutorial/guide on lighttpd/php/mysql guide for fun_plug 0.7?

    thanks!

  40. Hello,

    I’ve a question about fun_plug and the NAS Dlink DNS 320L: are all the manip are the same that for the DNS 320? Thx very much!!

  41. Hi there, first of all this is GREAT.
    I was very disapointed with my NAS because could not do almost anything, btw with this is close like a server.
    I just have a little problem, once I installed php and lighttp gd library is not working (does not appear in php_info(), I have tried the solutions above but no luck.
    I have also uncommented the ;extension=gd.so but still no luck.
    I have tried both /mnt/HD… and /ffp/… paths: no luck.
    Any ide? I need it to make a gallery of photos in web-page.
    Thanks!

  42. Please make a tutorial for fun_plug 0.7 lighttpd/php/mysql
    I really want to host my website from my DNS-320, but have had no luck following the tutorials from 0.5. I see others have also requested it. It would be a huge help! And thanks again for all the tutorials they are awesome!!!

    1. I second that. Has anyone got lighttpd + PHP + MySQL to work with fun_plug 0.7? If so, please share!

  43. I reinstalled fp0.5 on a dns 320L.
    pkg+openssl+curl+php+libiconv are all OK.
    The virtual link ln -s /ffp/opt/srv/ /srv works.
    But : ps aux|grep light =
    root @ nasAVS mnt/HD/HD_a2/ffp/home/root :/ # ps aux | grep light
    2807 root /usr/sbin/lighttpd-angel-D-m /usr /lighty_lib -f /etc/lighttpd/lighttpd.conf
    2808 root /usr/sbin/lighttpd -D -m /usr/lighty_lib -f /etc/lighttp/lighttpd.conf

    I can’t redirect lighttpd /etc/ to /ffp/ …
    What to do? thanks you help !

      1. Ach ya! Danke schön! Ich spreche nicht deutch aber ich habe ein freund wo sprecht gut deutch 😉

        Franchement merci beaucoup l’ami.

        1. you can use google translate…

          caution :

          copy commands from the un-translated page, as google translate sometimes introduces spaces and newline characters which will throw errors in the command…

          that’s how i did..made a mistake and learnt 😉
          have fun

          if you can point me to a good tutorial on how to host my website using lighttpd i will appreciate..

  44. Uli rocks, and has rocked for years.

    Here is a minor adjustment I had to make on my DNS-323 that uses fw 1.09, ffp 0.7 and fonz/uli packages as at 26 Apr 2013:

    The lighttpd.conf uses a different location for the access.log file. If the .conf file prescribes a file whose directory doesn’t exist, the lighttp daemon won’t start. You’ll have to choose whether to adapt the instructions, edit the .conf file or both. I chose to edit the .conf file. I ended up with:
    #### accesslog module
    #accesslog.filename = "/mnt/HD_a2/www/logs/access.log"
    accesslog.filename = "/srv/www/logs/access.log"

  45. Hi!

    after installing payload

    I cannot access the custom lighthttpd anymore, port 80 is now redirected to buildin web server

    when I issue the following commands :

    sh /ffp/start/kickwebs_dns320.sh
    sh /ffp/start/lighttpd.sh start

    returns:

    SSL: failed to initialize TLS servername callback, openssl library does not support TLS servername extension.

    somebody encountered this issue

  46. For those who cannot make it work and the lighttpd is using default config file (you can determine over SSH and use ps command to show current processes) there are bugs in file lighttpd.conf-dns320.

    1) remove flv-streaming.extensions = ( “.flv” ) line and comment out “mod_flv_streaming”

    2) $SERVER[“socket”] == “:443” {…….
    needs proper path for ssl.pemfile = “/etc/server.pem” which in my case was “/etc/certificate_https_all.pem ”

    Hope it helps 🙂

Leave a Reply to Larguitto Cancel reply

Your email address will not be published. Required fields are marked *

Exit mobile version