Setting up lighttpd 1.4.17 with ImageMagick

How many of you are simply using DNS-323 as a Network Attached Storage? Probably you are missing out on Peer-to-Peer applications like MLDonkey.

How about setting up a web server on the DNS-323 so that you can share your files with your friends, or perhaps host a image gallery on it to share your memories with your loved ones?

This writeup will guide you through the process of setting up lighttpd 1.4.14 with ImageMagick (completed with libpng, libjpeg) so that you can do some manipulation with images. But do take note image manipulation could take some time on the DNS-323.

So let begin by getting the required files.

Required files

  1. funplug-0.3.tar.gz
  2. lighttpd-1.4.17.tgz
  3. php-5.2.4.tgz
  4. imagemagick-6.3.4_9.tgz
  5. libjpeg-6b.tgz
  6. libpng-1.2.18.tgz

These files can be downloaded from fonz’s website.
Download all the files to Volume_1 of your DNS-323.

If you have already set up fun_plug (at least version 0.3) by fonz, then you can skip to Upgrading the lighttpd.

Setting up fonz’s fun_plug

  1. Extract the contents of funplug-0.3.tar.gz by winrar or other tools
  2. Place the contents on \\<DNS-323’s IP>\Volume_1\. So you would have \\<DNS-323’s IP>\Volume_1\fun_plug and \\<DNS-323’s IP>\Volume_1\fun_plug.tar
  3. Restart your DNS-323
  4. Wait for 60 seconds before proceeding to the next section

Upgrading the lighttpd
Telnet into your DNS323 by using a suitable client (e.g. putty). Execute the following commands.

/ # cd /mnt/HD_a2
/mnt/HD_a2 # funpkg.sh lighttpd-1.4.17.tgz
Unpacking lighttpd-1.4.17.tgz …
Installing files to /mnt/HD_a2/fun_plug.d …
Cleaning up
/mnt/HD_a2 #

Installing PHP 5.2.4

/mnt/HD_a2 # funpkg.sh php-5.2.4.tgz
Unpacking php-5.2.4.tgz …
Installing files to /mnt/HD_a2/fun_plug.d …
Cleaning up
/mnt/HD_a2 #

Configuring lighttpd

/mnt/HD_a2 # cp fun_plug.d/etc/lighttpd.conf-with-php-sample fun_plug.d/etc/lighttpd.conf
/mnt/HD_a2 # chmod +x funplug.d/start/lighttpd.sh

Installing ImageMagick, libpng, libjpeg

/mnt/HD_a2 # funpkg.sh imagemagick-6.3.4_9.tgz
Unpacking imagemagick-6.3.4_9.tgz …
Installing files to /mnt/HD_a2/fun_plug.d …
Cleaning up
/mnt/HD_a2 # funpkg.sh libpng-1.2.18.tgz
Unpacking libpng-1.2.18.tgz …
Installing files to /mnt/HD_a2/fun_plug.d …
Cleaning up
/mnt/HD_a2 # funpkg.sh libjpeg-6b.tgz
Unpacking libjpeg-6b.tgz …
Installing files to /mnt/HD_a2/fun_plug.d …
Cleaning up
/mnt/HD_a2 #

Setting up the necessary folders

/mnt/HD_a2 # mkdir -p www/pages
/mnt/HD_a2 # mkdir -p www/logs
/mnt/HD_a2 # chmod 0777 www/pages

Running lighttpd for the first time

/mnt/HD_a2 # ./fun_plug.d/start/lighttpd.sh

Point your web browser to the following address http://<DNS-323’s IP>:8080. If your lighttpd installation is successful, you should see the following page.

DNS323_lighttpd01small.gif
phpinfo() page

Place your webpages in /mnt/HD_a2/www/pages and you would be able to view them through lighttpd. The lighttpd will autostart everytime the DNS-323 is rebooted.

Have fun!

 

Treat shadowandy!

If these step-by-step guides have been very helpful to you and saved you a lot of time, please consider treating shadowandy to a cup of Starbucks.  

10 thoughts on “Setting up lighttpd 1.4.17 with ImageMagick

  • January 12, 2008 at 6:17 am
    Permalink

    hey thanks for the write up. however i don’t see where imagemagick figures in this? How do we use it to share photos on the http?

  • January 12, 2008 at 12:41 pm
    Permalink

    ciac,

    Most of the image/photo gallery scripts on the web requires some form of image manipulation libraries (e.g. ImageMagick or GDLib). So this guide actually sets up the basics for all these gallery scripts

  • February 3, 2008 at 3:25 am
    Permalink

    I followed your steps, without any reported errors. But when i point the browser to http://:8080 there is no page to display. In the fun_plug log file it shows that lighttpd has started.
    Any ideas?

  • February 3, 2008 at 3:35 am
    Permalink

    oops, sorry, it seemed not to post it at first

  • February 12, 2008 at 12:54 am
    Permalink

    /mnt/HD_a2/fun_plug.d/start # ${BINDIR}/lighttpd -f ${ETCDIR}/lighttpd.conf
    2008-02-11 17:51:44: (mod_accesslog.c.535) opening access-log failed: Noch file or directory /mnt/HD_a2/www/logs/access.log
    2008-02-11 17:51:44: (server.c.880) Configuration of plugins failed. Going down.

    Solution: Make logs directory 😉

  • February 29, 2008 at 2:29 pm
    Permalink

    Hi I’ve followed the instructions word for word for installing and settign up Lighthttp but I’m having some problems starting lighthttp as it never seems to start I start it but I don’t see it under procesess, I’ve did a strace but the stuff spit out makes absolute no sense to me (sorry Linux newb)

    /mnt/HD_a2 # strace ./fun_plug.d/start/lighttpd.sh
    execve(“./fun_plug.d/start/lighttpd.sh”, [“./fun_plug.d/start/lighttpd.sh”], [/*
    16 vars */]) = 0
    old_mmap(NULL, 20, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4
    0005000
    stat(“/etc/ld-uclibc.so.cache”, 0xbec57a2c) = -1 ENOENT (No such file or directo
    ry)
    open(“/mnt/HD_a2/fun_plug.d/lib/libc.so.0”, O_RDONLY) = -1 ENOENT (No such file
    or directory)
    open(“/lib/libc.so.0”, O_RDONLY) = 3
    old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0
    x40006000
    read(3, “\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0`\346\0\000″…, 4096) = 4
    096
    old_mmap(NULL, 364544, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4000d000
    old_mmap(0x4000d000, 306644, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) =
    0x4000d000
    old_mmap(0x4005f000, 7876, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x4a0
    00) = 0x4005f000
    old_mmap(0x40061000, 18528, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANON
    YMOUS, -1, 0) = 0x40061000
    close(3) = 0
    munmap(0x40006000, 4096) = 0
    ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo …}) = 0
    ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo …}) = 0
    rt_sigaction(SIGCHLD, {SIG_DFL}, {SIG_DFL}, 8) = 0
    getpid() = 30759
    brk(0) = 0x11f000
    brk(0x121000) = 0x121000
    getcwd(“/mnt/HD_a2”, 4098) = 11
    geteuid() = 0
    getppid() = 30758
    open(“./fun_plug.d/start/lighttpd.sh”, O_RDONLY|O_LARGEFILE) = 3
    fcntl64(3, F_DUPFD, 10) = 10
    close(3) = 0
    fcntl64(10, F_SETFD, FD_CLOEXEC) = 0
    rt_sigaction(SIGINT, NULL, {SIG_IGN}, 8) = 0
    rt_sigaction(SIGQUIT, NULL, {SIG_IGN}, 8) = 0
    rt_sigaction(SIGHUP, NULL, {SIG_DFL}, 8) = 0
    rt_sigaction(SIGHUP, {SIG_DFL}, NULL, 8) = 0
    rt_sigaction(SIGTSTP, NULL, {SIG_DFL}, 8) = 0
    rt_sigaction(SIGTSTP, {SIG_DFL}, NULL, 8) = 0
    rt_sigaction(SIGPIPE, NULL, {SIG_IGN}, 8) = 0
    read(10, “#!/bin/sh\n\nlighttpd_start() {\n “…, 4095) = 753
    stat(“.”, {st_mode=S_IFDIR|0777, st_size=4096, …}) = 0
    open(“.”, O_RDONLY) = 3
    fcntl(3, F_SETFD, FD_CLOEXEC) = 0
    brk(0x122000) = 0x122000
    getdents64(3, /* 20 entries */, 4096) = 664
    getdents64(3, /* 0 entries */, 4096) = 0
    close(3) = 0
    stat(“.”, {st_mode=S_IFDIR|0777, st_size=4096, …}) = 0
    open(“.”, O_RDONLY) = 3
    fcntl(3, F_SETFD, FD_CLOEXEC) = 0
    getdents64(3, /* 20 entries */, 4096) = 664
    getdents64(3, /* 0 entries */, 4096) = 0
    close(3) = 0
    stat(“.”, {st_mode=S_IFDIR|0777, st_size=4096, …}) = 0
    open(“.”, O_RDONLY) = 3
    fcntl(3, F_SETFD, FD_CLOEXEC) = 0
    getdents64(3, /* 20 entries */, 4096) = 664
    getdents64(3, /* 0 entries */, 4096) = 0
    close(3) = 0
    stat(“/mnt/HD_a2/fun_plug.d/bin”, {st_mode=S_IFDIR|0755, st_size=8192, …}) = 0
    open(“/mnt/HD_a2/fun_plug.d/bin”, O_RDONLY) = 3
    fcntl(3, F_SETFD, FD_CLOEXEC) = 0
    getdents64(3, /* 141 entries */, 4096) = 4080
    getdents64(3, /* 135 entries */, 4096) = 4088
    close(3) = 0
    stat(“.”, {st_mode=S_IFDIR|0777, st_size=4096, …}) = 0
    open(“.”, O_RDONLY) = 3
    fcntl(3, F_SETFD, FD_CLOEXEC) = 0
    getdents64(3, /* 20 entries */, 4096) = 664
    getdents64(3, /* 0 entries */, 4096) = 0
    close(3) = 0
    stat64(“/mnt/HD_a2/fun_plug.d/bin/[“, {st_mode=S_IFREG|S_ISUID|0755, st_size=751
    500, …}) = 0
    fork() = 30760
    — SIGCHLD (Child exited) @ 0 (0) —
    getpgrp() = 30758
    wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 30760
    stat(“.”, {st_mode=S_IFDIR|0777, st_size=4096, …}) = 0
    open(“.”, O_RDONLY) = 3
    fcntl(3, F_SETFD, FD_CLOEXEC) = 0
    getdents64(3, /* 20 entries */, 4096) = 664
    getdents64(3, /* 0 entries */, 4096) = 0
    close(3) = 0
    stat(“.”, {st_mode=S_IFDIR|0777, st_size=4096, …}) = 0
    open(“.”, O_RDONLY) = 3
    fcntl(3, F_SETFD, FD_CLOEXEC) = 0
    getdents64(3, /* 20 entries */, 4096) = 664
    getdents64(3, /* 0 entries */, 4096) = 0
    close(3) = 0
    stat64(“/mnt/HD_a2/fun_plug.d/bin/echo”, {st_mode=S_IFREG|S_ISUID|0755, st_size=
    751500, …}) = 0
    fork(Starting lighttpd…
    ) = 30761
    — SIGCHLD (Child exited) @ 0 (0) —
    getpgrp() = 30758
    wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 30761
    stat(“/mnt/HD_a2/fun_plug.d/bin”, {st_mode=S_IFDIR|0755, st_size=8192, …}) = 0
    open(“/mnt/HD_a2/fun_plug.d/bin”, O_RDONLY) = 3
    fcntl(3, F_SETFD, FD_CLOEXEC) = 0
    getdents64(3, /* 141 entries */, 4096) = 4080
    getdents64(3, /* 135 entries */, 4096) = 4088
    close(3) = 0
    stat(“.”, {st_mode=S_IFDIR|0777, st_size=4096, …}) = 0
    open(“.”, O_RDONLY) = 3
    fcntl(3, F_SETFD, FD_CLOEXEC) = 0
    getdents64(3, /* 20 entries */, 4096) = 664
    getdents64(3, /* 0 entries */, 4096) = 0
    close(3) = 0
    stat(“/mnt/HD_a2/fun_plug.d/etc”, {st_mode=S_IFDIR|0755, st_size=4096, …}) = 0
    open(“/mnt/HD_a2/fun_plug.d/etc”, O_RDONLY) = 3
    fcntl(3, F_SETFD, FD_CLOEXEC) = 0
    getdents64(3, /* 10 entries */, 4096) = 368
    close(3) = 0
    fork() = 30762
    getpgrp() = 30758
    wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 30762
    — SIGCHLD (Child exited) @ 0 (0) —
    read(10, “”, 4095) = 0
    _exit(0) = ?
    Process 30759 detached
    /mnt/HD_a2 #

    Any ideas?

  • September 22, 2008 at 6:47 am
    Permalink

    Hi,

    Tried your instruction installing lighttpd. Does’nt work with me, i get a permission denied error

    BusyBox v1.8.1 (2007-11-20 23:39:08 CET) built-in shell (ash)
    Enter ‘help’ for a list of built-in commands.

    /mnt/HD_a2 # /mnt/HD_a2 # funpkg.sh lighttpd-1.4.18.tgz
    /mnt/HD_a2/fun_plug.d/bin/sh: /mnt/HD_a2: Permission denied

    i tried chmod a+x for the tgz file and also 777, no difference

  • October 3, 2008 at 4:05 pm
    Permalink

    there should also be a guide of how to add ampache (it really will be gread boost to this nas) as well as daap server (firefly )

Comments are closed.