Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revisionLast revisionBoth sides next revision | ||
| docs:user-guide:luci:luci.on.lighttpd [2018/03/03 19:08] – ↷ Links adapted because of a move operation | docs:guide-user:luci:luci.on.lighttpd [2021/04/24 21:38] – HTTP/2 workaround is not necessary any more, fixed in lighttpd oldium | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== LuCI on lighttpd ====== | ====== LuCI on lighttpd ====== | ||
| - | This article explains how to run the [[docs: | + | LuCI is the main web administration utility for OpenWrt. |
| - | LuCI is the main web administration utility for OpenWrt. By default | + | |
| - | This is the howto for lighttpd. | + | You can use other web servers |
| See also: | See also: | ||
| - | * [[docs:user-guide: | + | * [[docs: |
| - | * [[docs:user-guide:services: | + | * [[docs: |
| + | |||
| + | Please be aware that versions from **version 1.4.56** to **version 1.4.59** had a [[https:// | ||
| ===== Installation ===== | ===== Installation ===== | ||
| Line 18: | Line 20: | ||
| </ | </ | ||
| **NOTE**: The **libiwinfo** package is only needed if your router has wireless. | **NOTE**: The **libiwinfo** package is only needed if your router has wireless. | ||
| + | |||
| + | Since lighttpd package version 1.4.56 the **SSL** module is not installed by default and you need to install one: | ||
| + | < | ||
| + | # Check the up-to-date list of lighttpd modules | ||
| + | opkg list lighttpd* | ||
| + | # Choose one and install it, version 1.4.56 offers lighttpd-mod-gnutls, | ||
| + | opkg install lighttpd-mod-openssl | ||
| + | </ | ||
| Then choose a LuCI theme | Then choose a LuCI theme | ||
| Line 28: | Line 38: | ||
| </ | </ | ||
| - | Afterwards check that ''/ | + | ===== Configuration ===== |
| - | |'' | + | Either go on with default configuration and make few changes, or add a file, which does the same. In order to understand the changes, lets start with default configuration |
| - | Now we need to tell lighttpd to process requests for the web interface using Lua. The LuCI administation package installs a file ''/ | + | ==== Using default |
| - | |''" | + | |
| - | to the cgi configuration | + | |
| - | |'' | + | Check that '' |
| - | " | + | |
| - | " | + | < |
| - | " | + | server.modules += ( " |
| - | " | + | </ |
| - | " | + | |
| - | '' | + | Now we need to tell lighttpd to process requests for the web interface using CGI. The LuCI administation package installs files in ''/ |
| + | < | ||
| + | "/ | ||
| + | "/ | ||
| + | "/ | ||
| + | "/ | ||
| + | "/ | ||
| + | </ | ||
| + | to the cgi configuration file (''/ | ||
| + | |||
| + | < | ||
| + | cgi.assign | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | "/ | ||
| + | "/ | ||
| + | "/ | ||
| + | "/ | ||
| + | | ||
| + | </ | ||
| This makes LuCI work as a CGI process. See http:// | This makes LuCI work as a CGI process. See http:// | ||
| - | Note that the index.html file in the document root ''/ | + | Note that the '' |
| - | If you want lighttpd's logs in the output of " | + | LuCI needs root privileges to access configuration, |
| - | |''# | + | < |
| - | server.errorlog-use-syslog | + | #server.username |
| - | '' | + | #server.groupname |
| + | </ | ||
| + | |||
| + | ==== Using easy configuration ==== | ||
| + | |||
| + | The same effect as the previous changes could be made, if you create file ''/ | ||
| - | Enable lighttpd (so that it will be started at every boot) and start it: | ||
| < | < | ||
| - | /etc/init.d/lighttpd enable | + | ## Necessary LUCI configuration |
| - | /etc/init.d/lighttpd start | + | cgi.assign += ( "/cgi-bin/luci" => "", |
| + | "/cgi-bin/ | ||
| + | " | ||
| + | "/cgi-bin/ | ||
| + | "/ | ||
| + | |||
| + | server.username := "" | ||
| + | server.groupname := "" | ||
| </ | </ | ||
| - | Add the following for the server to listen on ipv4 and ipv6 | + | Or specify CGI execution as a default for a whole ''/ |
| + | |||
| + | < | ||
| + | ## Necessary LUCI configuration | ||
| + | $HTTP[" | ||
| + | cgi.assign += ( "" | ||
| + | } | ||
| + | |||
| + | server.username := "" | ||
| + | server.groupname := "" | ||
| + | </ | ||
| + | |||
| + | ☝ The key to understand it is that '' | ||
| + | |||
| + | |||
| + | ==== Finalizing the configuration ==== | ||
| + | |||
| + | If you want lighttpd' | ||
| + | |||
| + | < | ||
| + | ## enable syslog | ||
| + | server.errorlog-use-syslog = " | ||
| + | </ | ||
| + | |||
| + | Add the following for the server to listen on ipv4 and ipv6 (create for example ''/ | ||
| < | < | ||
| #Listen on ipv4 | #Listen on ipv4 | ||
| Line 69: | Line 134: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | Enable lighttpd (so that it will be started at every boot) and start it: | ||
| + | < | ||
| + | / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== SSL Redirect ===== | ||
| + | |||
| + | If you want to redirect to SSL, install '' | ||
| + | |||
| + | < | ||
| + | opkg update | ||
| + | opkg install lighttpd-mod-redirect | ||
| + | </ | ||
| + | |||
| + | Next, create ''/ | ||
| + | |||
| + | < | ||
| + | $SERVER[" | ||
| + | ssl.engine | ||
| + | ssl.pemfile | ||
| + | } else $HTTP[" | ||
| + | $HTTP[" | ||
| + | url.redirect = (" | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | And if you have SSL certificate from any authority without hostname-only alias, you can redirect like the following (replace '' | ||
| + | |||
| + | < | ||
| + | $SERVER[" | ||
| + | ssl.engine | ||
| + | ssl.pemfile | ||
| + | } else $HTTP[" | ||
| + | $HTTP[" | ||
| + | url.redirect = (" | ||
| + | } else $HTTP[" | ||
| + | url.redirect = (" | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Unfortunately redirecting from https:// | ||
| ===== LuCI and Another Website Simultaneously on lighttpd (Listening on Multiple Ports) ===== | ===== LuCI and Another Website Simultaneously on lighttpd (Listening on Multiple Ports) ===== | ||
| Line 83: | Line 194: | ||
| Now we simply need to use lighttpd' | Now we simply need to use lighttpd' | ||
| - | | '' | + | < |
| - | server.document-root = "/ | + | $SERVER[" |
| - | }'' | + | server.document-root = "/ |
| + | } | ||
| + | </ | ||
| After restarting lighttpd your website is on port 81 and LuCI is still on port 80 using lighttpd. Naturally, you can interchange these two ports such that the website is on the default HTTP port 80 and set the web interface on port 81. | After restarting lighttpd your website is on port 81 and LuCI is still on port 80 using lighttpd. Naturally, you can interchange these two ports such that the website is on the default HTTP port 80 and set the web interface on port 81. | ||