Differences

This shows you the differences between two versions of the page.

doc:howto:lamp [2013/05/11 14:10]
tmomas added missing 'php'
doc:howto:lamp [2013/08/12 20:55] (current)
grabbel completed the table
Line 1: Line 1:
====== Set up a LAMP stack on OpenWrt ====== ====== Set up a LAMP stack on OpenWrt ======
-Read here: [[wp>LAMP (software bundle)]] about the concept. This guide provides step by step instructions for installing a full featured LAMP stack on OpenWrt. 
-^ Service ^ Software used ^ Description  ^ +/*** Frankly, this page is a mess. It has lots of overlap with the main pages for the different components. Also, steps to take are sometimes overly specific, things like NEW: <it was this> OLD: <change it to this> and also "change the line after <... this line ...> to <... this line ...>. That's too specific: readers are not stupid. Second thing is they don't explain things, but only provide the config. This is not how a guide should be written: you should give the config lines, but also explain what they do. I removed most of them now, but maybe this page can be removed in its entirety
-| Web server          | [[doc:howto:http.overview]]          | a lot of web server to choose from  | +***/
-|                    | [[http.uhttpd|uHTTPd]]      | this is already used for the WebUI LuCI  | +
-|                    | [[http.lighttpd|Lighttpd]]  |  | +
-|                    | [[http.apache|Apache]]      |  | +
-|                    | [[http.nginx|Nginx]]        |  | +
-| Database server    | [[doc:howto:database.overview]]      | you have again the choice  | +
-|                    | [[database.mysql|MySQL]]            |  | +
-|                    | [[database.postgresql|PostgreSQL]]  |  | +
-| Scripting language  | [[doc:howto:PHP]]            |    | +
-|                    | [[doc:howto:Perl]]          |  | +
-|                    | [[doc:howto:Python]]        |  |+
 +Read here: [[wp>LAMP (software bundle)]] about the concept. This guide provides step by step instructions for installing a full featured LAMP stack on OpenWrt.
 +
 +^ Service                                    ^ Examples                              ^ Description  ^
 +| [[http.overview|Web server]]              | [[http.uhttpd|uHTTPd]]                | OpenWrt's in-house server, used by default for the WebUI LuCI |
 +| :::                                        | [[http.lighttpd|Lighttpd]]            | Lightweight and flexible, many addons |
 +| :::                                        | [[http.apache|Apache]]                | Powerful and widely used|
 +| :::                                        | [[http.nginx|Nginx]]                  | Aimed at good performance, low memory|
 +| [[database.overview|Database server]]      | [[database.mysql|MySQL]]              | Widely used SQL server|
 +| :::                                        | [[database.postgresql|PostgreSQL]]    | Another popular SQL server|
 +| :::                                        | [[database.sqlite|SQLite]]            | Easy to use SQL //library// for low powered devices, runs within process|
 +| [[scripting.overview|Scripting language]]  | [[doc:howto:PHP]]                      | Specially designed for making websites|
 +| :::                                        | [[doc:howto:Perl]]                    | Flexible high level general purpose language|
 +| :::                                        | [[doc:howto:Python]]                  | Another high level scripting language|
===== Basic System Configuration ===== ===== Basic System Configuration =====
 +This article is a collection of examples of the configuration and integration of web servers, database servers and scripting languages, i.e. LAMP. For each example we assume to be creating a web page with ''/srv/www/'' as the document root and assume an otherwise standard OpenWrt configuration. Note that it currently has a lot of overlap with the main articles for the respective services. FIXME It should be made more to the point and only about installing and especially integrating these services.
 +
 +/* THIS SECTION HAS BEEN COMMENTED OUT, PENDING DELETION.
 +To the author of this part: It is very unclear to me why you would be changing your hosts file just to accomodate an example. Also, the llmp you take as a host name is almost never used in the rest of the article. Please clarify and complete the rest of the examples, while trying not to create to much overlap with the main articles for the web servers, scripting and database tools etc. For now, I have commented out this section and updated the remainder of the article. Feel free to discuss about it.
 +
Modify your ''/etc/hosts'' file to resemble the following example. Replace "domain.tld" with your own domain name, and select a unique name to replace "llmp" with. This will be your system's FQDN (Fully Qualified Domain Name). Modify your ''/etc/hosts'' file to resemble the following example. Replace "domain.tld" with your own domain name, and select a unique name to replace "llmp" with. This will be your system's FQDN (Fully Qualified Domain Name).
Line 42: Line 49:
echo "$(uci get system.@system[0].hostname)" > /proc/sys/kernel/hostname echo "$(uci get system.@system[0].hostname)" > /proc/sys/kernel/hostname
</code> </code>
 +*/
===== Installing and configuring a web server ===== ===== Installing and configuring a web server =====
Line 93: Line 101:
Edit ''/etc/lighttpd/lighttpd.conf'' and change a few settings: Edit ''/etc/lighttpd/lighttpd.conf'' and change a few settings:
-OLD+Enable CGI
-| ''#server.modules = ( +
-#      "mod_cgi" +
-#)'' | +
-NEW:+
| ''server.modules = ( | ''server.modules = (
      "mod_cgi"       "mod_cgi"
)'' | )'' |
-OLD: +Set the document root and the port for our example: 
-| ''%%server.document-root = "/www/"%%'' | +
-NEW:+
| ''%%server.document-root = "/srv/www/"%%'' | | ''%%server.document-root = "/srv/www/"%%'' |
-OLD: 
-| ''#server.port = 81'' | 
-NEW: 
| ''server.port = 81'' | | ''server.port = 81'' |
-(End of changes to ''/etc/lighttpd/lighttpd.conf'')+Edit ''/etc/php.ini'' and set the document root here as well (or leave it empty, in which case it allows PHP serving anywhere outside the docroot):
-Edit ''/etc/php.ini'' and change: 
- 
-OLD: 
-| ''doc_root = "/www"'' | 
-NEW: 
| ''doc_root = "/srv/www"'' | | ''doc_root = "/srv/www"'' |
-(End of changes to /etc/php.ini)  +Create a directory for our web server content:
- +
-Create a directory for our web server content+
<code> <code>
mkdir -p /srv/www mkdir -p /srv/www
Line 150: Line 144:
Point your browser to the routers IP address and the port the web server is listening on (e. g. [[http://192.168.1.1:81/index.html|http://192.168.1.1:81/index.html]]) Point your browser to the routers IP address and the port the web server is listening on (e. g. [[http://192.168.1.1:81/index.html|http://192.168.1.1:81/index.html]])
-===== Installing PHP ===== +===== Installing and Configuring PHP ===== 
-See ->[[doc:howto:PHP]] to install a version of PHP. +See ->[[doc:howto:PHP]] to install a version of PHP. The remainder of this section assumes you have a proper PHP install.
- +
-===== Configuring PHP ===== +
==== uHTTPd ==== ==== uHTTPd ====
Line 183: Line 174:
[[http.lighttpd#php]] [[http.lighttpd#php]]
-In ''/etc/lighttpd/lighttpd.conf'' change+In ''/etc/lighttpd/lighttpd.conf'' set the following to activate PHP for files with ''.php'' extension.
-Right after 
-| ''%%#cgi.assign = ( ".pl"  => "/usr/bin/perl", ".cgi" => "/usr/bin/perl" )%%'' | 
-add 
| ''%%cgi.assign = ( ".php"  => "/usr/bin/php-cgi" )%%'' | | ''%%cgi.assign = ( ".php"  => "/usr/bin/php-cgi" )%%'' |
-Change +Add index.php to the default file names, such that it loads it automatically if present
-| ''index-file.names = ( "index.html", "default.html", "index.htm", "default.htm" )'' | +
-to+
| ''index-file.names = ( "index.html", "default.html", "index.htm", "default.htm", "index.php" )'' | | ''index-file.names = ( "index.html", "default.html", "index.htm", "default.htm", "index.php" )'' |
-And in ''/etc/php.ini'' change +Set the proper document root 
-| ''doc_root = "/www"'' | +
-to+
| ''doc_root = "/srv/www"'' | | ''doc_root = "/srv/www"'' |
-ps: If you are making some crazy URL rewriting in lighttpd and getting a 'No input file specified.' error in the browser, remove this configuration (as per [[http://redmine.lighttpd.net/projects/1/wiki/frequentlyaskedquestions|lighttpd FAQ]]) 
 +/*  what is meant by this? what configuration? I commented it out, please someone explain or delete: //Remark:// If you are doing some crazy URL rewriting in lighttpd and getting a 'No input file specified.' error in the browser, remove this configuration (as per [[http://redmine.lighttpd.net/projects/1/wiki/frequentlyaskedquestions|lighttpd FAQ]]) */
-Restart lighttpd+Restart lighttpd:
<code> <code>
/etc/init.d/lighttpd restart /etc/init.d/lighttpd restart
Line 286: Line 272:
-For **MySQL** to work with **PHP**, you must also configure the //**php.ini**// (vi /etc/php.ini) file, under the [MySQL] section.+For **MySQL** to work with **PHP**, you must also configure the //**php.ini**// (vi /etc/php.ini) file, under the [MySQL] section.
  * Here is an example:   * Here is an example:

Back to top

doc/howto/lamp.1368274225.txt.bz2 · Last modified: 2013/05/11 14:10 by tmomas