Differences
This shows you the differences between the selected revision and the current version of the page.
howto:lighttpd_php 2007/12/16 18:49 | howto:lighttpd_php 2017/09/06 18:38 current | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== HOWTO Build lighttpd ====== | ====== HOWTO Build lighttpd ====== | ||
- | First, set up your [[crosscompile]] toolchain. Download {{:howto:build_lighttpd_pa1.tgz}}. Extract, edit the file to correct the bug in **tar xvfz zips/.tar.gz --> tar xvfz zips/$APP-$APP_VER.tar.gz** and then execute. | + | First, set up your [[crosscompile]] toolchain. Download {{:howto:build_lighttpd_pa1.tgz}}. Extract, edit the file to correct the bug in **tar xvfz zips/.tar.gz --> tar xvzf zips/$APP-$APP_VER.tar.gz** and then execute. |
+ | |||
+ | Quick helper: Also note that you need to create a /zips/ folder (or add it to the above script right after [if ! -f zips ]), otherwise the script breaks | ||
Transfer the result, dns323_lighttpd-1.4.13.tar.gz, to /mnt/HD_a2 and extract it ''lnx_bin/busybox3 tar xvz -f dns323_lighttpd-1.4.13.tar.gz'' | Transfer the result, dns323_lighttpd-1.4.13.tar.gz, to /mnt/HD_a2 and extract it ''lnx_bin/busybox3 tar xvz -f dns323_lighttpd-1.4.13.tar.gz'' | ||
Line 28: | Line 30: | ||
Access your server on port 3000, e.g. ''http://192.168.0.200:3000/index.html'' | Access your server on port 3000, e.g. ''http://192.168.0.200:3000/index.html'' | ||
+ | |||
Line 35: | Line 38: | ||
===== Note on lighttpd version ===== | ===== Note on lighttpd version ===== | ||
Beginning with 1.5.0, lighttpd depends on glib2. | Beginning with 1.5.0, lighttpd depends on glib2. | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Notes on using port 80 for lighttpd ===== | ||
+ | For fun-plug v0.5 click [[http://wiki.dns323.info/howto:ffp#lighttpd_web_server|here]] and look for **Port 80** for fun-plug versions 0.3 & 0.4 see below... | ||
+ | |||
+ | Since the DNS-323 Admin service (webs) uses port 80 in order to use port 80 for lighttpd you'll need to do the following: | ||
+ | |||
+ | - Modify ligttpd.conf file to include "server.port = 80" | ||
+ | - Stop the lighttpd service | ||
+ | - Stop the 'webs' service | ||
+ | - Start the lighttpd service | ||
+ | |||
+ | or use the two scripts below and make sure you put them in ./fun_plug.d/start directory with the correct CHMOD settings so they run automatically. | ||
+ | |||
+ | The admin service on your DNS-323 will now be available on port 81. To access: ''http://192.168.0.200:81'' | ||
+ | |||
+ | Here's the 'lighttpd.sh' script: | ||
+ | <code> | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # This script was modified by Paul on 2/2/08 as a work around | ||
+ | # in getting the admin website off of port 80 and on to port 81 | ||
+ | # It is used in conjuction with admwebs.sh (created) which is | ||
+ | # called from this script. lighttpd.sh stops (via admwebs.sh) the | ||
+ | # web admin service and then starts lighttpd on port 80. The web admin | ||
+ | # now (automatically) starts on port 81 after a few seconds. The admin | ||
+ | # service tests for use on port 80. If it's in use then bumps to the | ||
+ | # next available port (in this case it's bumped to port 81). | ||
+ | # | ||
+ | # NOTE: | ||
+ | # ./fun_plug.d/etc/lighttpd.conf needs to be configured to use | ||
+ | # port 80 | ||
+ | # | ||
+ | # USE "netstat -tln" to verify that both port 80 & 81 are in use. | ||
+ | # | ||
+ | |||
+ | lighttpd_start() { | ||
+ | |||
+ | # make sure, upload directory exists | ||
+ | # path must match server.upload-dirs in lighttpd.conf file! | ||
+ | mkdir -p ${VOL1}/tmp | ||
+ | chmod 01777 ${VOL1}/tmp | ||
+ | |||
+ | if [ -x "${SBINDIR}/lighttpd" ]; then | ||
+ | echo "Stopping WEB admin" | ||
+ | /mnt/HD_a2/fun_plug.d/start/admwebs.sh stop | ||
+ | echo "Starting lighttpd... " | ||
+ | ${SBINDIR}/lighttpd -f ${ETCDIR}/lighttpd.conf 1>/dev/null 2>/dev/null </dev/null | ||
+ | echo "Starting WEB admin on port 81" | ||
+ | /mnt/HD_a2/fun_plug.d/start/admwebs.sh start | ||
+ | echo "done!" | ||
+ | else | ||
+ | echo "ERROR: lighttpd not found or not executable" | ||
+ | fi | ||
+ | } | ||
+ | |||
+ | lighttpd_stop() { | ||
+ | killall lighttpd | ||
+ | } | ||
+ | |||
+ | |||
+ | lighttpd_status() { | ||
+ | if [ -n "$(pidof lighttpd)" ]; then | ||
+ | echo "running" | ||
+ | else | ||
+ | echo "stopped" | ||
+ | fi | ||
+ | } | ||
+ | |||
+ | case "$1" in | ||
+ | stop) | ||
+ | lighttpd_stop | ||
+ | ;; | ||
+ | restart) | ||
+ | lighttpd_stop | ||
+ | sleep 1 | ||
+ | lighttpd_start | ||
+ | ;; | ||
+ | status) | ||
+ | lighttpd_status | ||
+ | ;; | ||
+ | start|'') | ||
+ | lighttpd_start | ||
+ | ;; | ||
+ | *) | ||
+ | echo "Usage: $0 start|stop|restart|status" | ||
+ | ;; | ||
+ | esac | ||
+ | </code> | ||
+ | |||
+ | Here's the 'admwebs.sh' script: | ||
+ | <code> | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # This script was created by Paul on 2/2/08 as a work around | ||
+ | # in getting the admin website off of port 80 and on to port 81 | ||
+ | # It is used in conjuction with lighttpd.sh (also modified) which | ||
+ | # calls this script. When used from lighttpd.sh it stops the | ||
+ | # web admin service then starts lighttpd on port 80. The web admin | ||
+ | # service notices that something is on port 80 and then starts on | ||
+ | # port 81. | ||
+ | # | ||
+ | # NOTE: | ||
+ | # ./fun_plug.d/etc/lighttpd.conf needs to be configured to use | ||
+ | # port 80 | ||
+ | # | ||
+ | # NOTE2: (2/14/08) | ||
+ | # Updated this script to remove "Starting" webs. Apparently | ||
+ | # if you start webs you will not be able to add users | ||
+ | # webs is set to automatically restart if the /web/webs service | ||
+ | # is stopped. | ||
+ | # | ||
+ | |||
+ | admwebs_start() { | ||
+ | if [ -x "/web/webs" ]; then | ||
+ | # echo "Starting webs... " | ||
+ | # /web/webs & > /dev/null | ||
+ | echo "/webs/webs service will start automatically in 45 sec" | ||
+ | else | ||
+ | echo "ERROR: /web/webs not found or not executable" | ||
+ | fi | ||
+ | } | ||
+ | |||
+ | admwebs_stop() { | ||
+ | killall webs | ||
+ | } | ||
+ | |||
+ | admwebs_status() { | ||
+ | if [ -n "$(pidof webs)" ]; then | ||
+ | echo "running" | ||
+ | else | ||
+ | echo "stopped" | ||
+ | fi | ||
+ | } | ||
+ | |||
+ | case "$1" in | ||
+ | stop) | ||
+ | admwebs_stop | ||
+ | ;; | ||
+ | restart) | ||
+ | admwebs_stop | ||
+ | sleep 1 | ||
+ | admwebs_start | ||
+ | ;; | ||
+ | status) | ||
+ | admwebs_status | ||
+ | ;; | ||
+ | start|'') | ||
+ | admwebs_start | ||
+ | ;; | ||
+ | *) | ||
+ | echo "Usage: $0 start|stop|restart|status" | ||
+ | ;; | ||
+ | esac | ||
+ | </code> | ||
Line 40: | Line 200: | ||
* A pre-compiled variant can be found {{:howto:dns323_lighttpd-1.4.13.tar.gz|here}} | * A pre-compiled variant can be found {{:howto:dns323_lighttpd-1.4.13.tar.gz|here}} | ||
* lighttpd is also included in [[http://www.inreto.de/dns323/fun-plug/|fonz's fun_plug pack]], a comprehensive fun_plug package that's easy to implement and great for first time users. php is a separate package that can be added easily. Instructions are provided. | * lighttpd is also included in [[http://www.inreto.de/dns323/fun-plug/|fonz's fun_plug pack]], a comprehensive fun_plug package that's easy to implement and great for first time users. php is a separate package that can be added easily. Instructions are provided. | ||
+ | |||
+ | |||
+ | ===== Lighttpd for Windows Users ===== | ||
+ | |||
+ | |||
+ | if you don't speak linux gibberish: | ||
+ | |||
+ | Before you begin: | ||
+ | |||
+ | Install Putty on your PC: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html | ||
+ | |||
+ | Install Netscan on your PC: http://www.softperfect.com/products/networkscanner/ | ||
+ | |||
+ | Run Netscan. click the Options tab, then the Additional subtab. Click all the buttons. in the box on the bottom type 22, 23, 80, 443, 8080. Click OK. | ||
+ | |||
+ | Click the IP box, then click the range of your network in the box that pops up. | ||
+ | |||
+ | these files must be in these locations in Volume_1 of the DNS-323: | ||
+ | |||
+ | //lighttpd.sh in /ffp/start// | ||
+ | |||
+ | //lighttpd.conf in ffp/etc/examples// | ||
+ | |||
+ | these files are installed by default when fun plug runs the first time | ||
+ | |||
+ | Create these folders: | ||
+ | |||
+ | //Volume_1/www// | ||
+ | |||
+ | //Volume_1/www/logs// | ||
+ | |||
+ | //Volume_1/www/pages// | ||
+ | |||
+ | Run Putty. You will get a black box with an octet: # and a green cursor. you will enter the commands below at the green cursor. the octet is shown as a | ||
+ | |||
+ | reference point. | ||
+ | |||
+ | this command will copy the lighttpd configuration file /examples to ffp/etc: | ||
+ | |||
+ | **# cd /ffp/etc** | ||
+ | |||
+ | **# cp examples/lighttpd.conf /ffp/etc/lighttpd.conf** | ||
+ | |||
+ | this makes the lighttpd shell file in the /ffp/start directory executeable: | ||
+ | |||
+ | **# cd /ffp/start** | ||
+ | |||
+ | **# chmod +x lighttpd.sh** | ||
+ | |||
+ | it will not start if lighttpd.conf is not in /ffp/etc | ||
+ | |||
+ | to manually start lighttpd: | ||
+ | |||
+ | **# sh /ffp/start/lighttpd.sh start** | ||
+ | |||
+ | If it's running you will see port 8080 open on your DNS-323 when you Start Scanning in Netscan | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Lighttpd with SQLite ===== | ||
+ | |||
+ | Update extensions path in php.ini to point to '/ffp/lib/php/extensions/no-debug-non-zts-20 | ||
+ | 060613/' | ||
+ | |||
+ | ==== Installation of SQLite ==== | ||
+ | |||
+ | |||
+ | * wget http://www.inreto.de/dns323/fun-plug/0.5/packages/sqlite-3.5.6-3.tgz | ||
+ | * funpkg -i sqlite-3.5.6-3.tgz | ||
+ | |||
+ | |||
+ | ==== Configuration of PHP ==== | ||
+ | |||
+ | * Add some lines to /ffp/etc/php.ini if you need support for SQL in PHP (Create file if needed): | ||
+ | ''[PHP]\\ | ||
+ | extension=pdo.so\\ | ||
+ | extension=pdo_sqlite.so\\ | ||
+ | extension=sqlite.so'' | ||
+ | * Restart ligthttpd (As root): | ||
+ | ''/ffp/start/lighttpd.sh restart'' | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ |