How to Install Lighttpd & PHP on Dlink DNS-320

I just obtain my new D-link DNS-320 NAS Storage which supposed to replace my older DNS-323 that died recently. As before, I need to install Webserver Lighttpd & PHP. This guide assumed that you have installed Fonz fun_plug in your DNS-320. This guide should work on D-link DNS-325 as well.

I choose fonz fun_plug version 0.5 instead of version 0.7 as I am unable to get it working correctly.

This guides are divided into 3 main section namely download packages, install, configure & finishing up. I also include some optional guides.


1. Download lighttpd packages

2. Download PHP packages


1. Run PuTTY and log into DNS-320

2. Change directory to “/mnt/HD/HD_a2” & create “pkg” folder inside “ffp” folder. If you are copying from a Windows PC you may need to set permission to copy.

cd /mnt/HD/HD_a2
mkdir -p /ffp/pkg
chmod -R 0777 /ffp/pkg

3. Copy all packages downloaded above into the folder “/ffp/pkg

4. Update & install Lighttpd packages

funpkg -u /ffp/pkg/lighttpd-1.4.29-1.tgz
funpkg -i /ffp/pkg/openssl-0.9.8k-1.tgz

5. Install PHP packages

funpkg -i /ffp/pkg/php-5.2.17-3.tgz
funpkg -i /ffp/pkg/curl-7.23.0-1.tgz
funpkg -i /ffp/pkg/libiconv-1.12-3.tgz


1. Create all folders required by Lighttpd

mkdir -p /ffp/opt/srv/mysql
mkdir -p /ffp/opt/srv/www/pages
mkdir -p /ffp/opt/srv/www/logs
mkdir -p /ffp/opt/srv/tmp

2. Create a symbolic link

ln -s /ffp/opt/srv/ /srv

3. Symbolik link above will be lost when you restart your DNS-320. To make it permanent, edit “/ffp/etc/fun_plug.init” file. If you are editing it from a Windows PC you may need to set permission to edit.

chmod 0777 /ffp/etc/fun_plug.init

4. Open your favoutrite text editor (don’t use notepad or it will corrupt the files) and open “/ffp/etc/fun_plug.init” file. Add the following at the end.

ln -s /ffp/opt/srv/ /srv

5.  Copy Lighttpd & PHP configuration files

cp /ffp/etc/examples/lighttpd.conf-dns320 /ffp/etc/lighttpd.conf
cp /ffp/etc/examples/php.ini-wolfuli /ffp/etc/php.ini

6. Stating up Lighttpd webserver

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

Finishing up

1. Your Lighttpd with PHP support should be running by now. Root folder of the web server is located at “/ffp/opt/srv/www/pages“. Test it by create a file named “index.php” which contains the following.

<h1>This is normal HTML</h1>
But the <u>following table</u> is generated by PHP:

2. Open web browser and point it to “http://dns320-ip/“. Change “dns320-ip” to your DNS-320 IP address. You should see both notmal HTML & PHP generated output. Your DNS-320 admin page had move to “http://dns320-ip:81/”


1. For me, I would like to change Lighttpd port to “8080” & revert back admin page to port “80“. To do this, I need to edit “/ffp/etc/lighttpd.conf” file. If you are editing it from a Windows PC you may need to set permission to edit.

chmod 0777 /ffp/etc/lighttpd.conf

i. Find the following

server.port = 80

and change it to

server.port = 8080

ii. Find the following

$SERVER["socket"] == ":81" {

and change it to

$SERVER["socket"] == ":80" {

2. I also would like to enable directory listing. On the same “/ffp/etc/lighttpd.conf” file.

i. Find the following

#dir-listing.activate        = "enable"

and change it to

dir-listing.activate        = "enable"

3. To apply the changes, you have to restart Lighttpd.

sh /ffp/start/ restart

4. By now, your web server serving port should change to “8080” and admin page port back to “80“. Test it on your web browser.