SliTaz GNU/Linux official and community documentation wiki.
.png

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:handbook:webserver [2010/02/26 22:29]
linea
en:handbook:webserver [2012/12/24 17:52]
trixar_za [CGI scripts using Python]
Line 23: Line 23:
  
 The main configuration file for LightTPD (lighttpd.conf) is located in ///​etc/​lighttpd///​. This file provided by SliTaz is self-explanatory,​ just browse. You can find other examples on the LightTPD website. On SliTaz you'll also find a //​vhosts.conf//​ file for the configuration of any virtual hosts (hosting several sites on the same server). The main configuration file for LightTPD (lighttpd.conf) is located in ///​etc/​lighttpd///​. This file provided by SliTaz is self-explanatory,​ just browse. You can find other examples on the LightTPD website. On SliTaz you'll also find a //​vhosts.conf//​ file for the configuration of any virtual hosts (hosting several sites on the same server).
-Start, stop, restart the web server+ 
 +=====Start, stop, restart the web server=====
  
 By default, SliTaz starts the server automatically at boot, to prevent this you need to remove lighttpd from the variable //​RUN_DAEMONS//​ located in the system file ///​etc/​rcS.conf//​. To start, stop or restart the server, you can use the commands: ///​etc/​init.d/​lighttpd [start|stop|restart]//​. Example to restart the server after changing the configuration file: By default, SliTaz starts the server automatically at boot, to prevent this you need to remove lighttpd from the variable //​RUN_DAEMONS//​ located in the system file ///​etc/​rcS.conf//​. To start, stop or restart the server, you can use the commands: ///​etc/​init.d/​lighttpd [start|stop|restart]//​. Example to restart the server after changing the configuration file:
Line 34: Line 35:
  
 <​code>​ # tazpkg get-install perl <​code>​ # tazpkg get-install perl
- # geany /​etc/​lighttpd/​lighttpd.conf & + # geany /​etc/​lighttpd/​lighttpd.conf & </​code>​
  
 +
 +<​file>​
 # CGI module. You can install Perl and assign .pl and .cgi scripts # CGI module. You can install Perl and assign .pl and .cgi scripts
 # to /​usr/​bin/​perl # to /​usr/​bin/​perl
Line 41: Line 44:
   cgi.assign = (   cgi.assign = (
     "​.sh"​ => "/​bin/​sh",​     "​.sh"​ => "/​bin/​sh",​
-    "​.cgi"​ => "/​usr/​bin/​perl,​ +    "​.cgi"​ => "/​usr/​bin/​perl"
-    "​.pl"​ => "/​usr/​bin/​perl+    "​.pl"​ => "/​usr/​bin/​perl"
   )   )
 } }
  
-</code>+</file>
  
 ===== CGI scripts using Python ===== ===== CGI scripts using Python =====
Line 54: Line 57:
  # tazpkg get-install python  # tazpkg get-install python
  # geany /​etc/​lighttpd/​lighttpd.conf &  # geany /​etc/​lighttpd/​lighttpd.conf &
 +</​code>​
  
 +<​file>​
 # CGI module. You can install Python and assign .py and .cgi scripts # CGI module. You can install Python and assign .py and .cgi scripts
 # to /​usr/​bin/​python # to /​usr/​bin/​python
Line 60: Line 65:
   cgi.assign = (   cgi.assign = (
     "​.sh"​ => "/​bin/​sh",​     "​.sh"​ => "/​bin/​sh",​
-    "​.cgi"​ => "/​usr/​bin/​python,​ +    "​.cgi"​ => "/​usr/​bin/​python"
-    "​.py"​ => "/​usr/​bin/​python+    "​.py"​ => "/​usr/​bin/​python"
   )   )
 } }
-</code>+</file>
  
 For the changes to be taken into effect and to use your first CGI scripts on SliTaz, just restart the LightTPD server: For the changes to be taken into effect and to use your first CGI scripts on SliTaz, just restart the LightTPD server:
Line 74: Line 79:
 LightTPD provides authentication modules that can for example, protect a directory. The server offers several authentication methods, but we will begin by using the basic method without encrypting any passwords. In order to be able to use the module mod_auth, you must install the lighttpd-modules package (tazpkg get-install lighttpd-modules). Once installed mod_auth must be added to the list of modules: LightTPD provides authentication modules that can for example, protect a directory. The server offers several authentication methods, but we will begin by using the basic method without encrypting any passwords. In order to be able to use the module mod_auth, you must install the lighttpd-modules package (tazpkg get-install lighttpd-modules). Once installed mod_auth must be added to the list of modules:
  
-<code>+<file>
 # Modules to load. # Modules to load.
 # See /​usr/​lib/​lighttpd for all available modules. # See /​usr/​lib/​lighttpd for all available modules.
Line 83: Line 88:
   "​...",​   "​...",​
 ) )
-</code>+</file>
  
-Now you can configure the modules by specifying the debug level and method (plain) and the path to the file containing a list of names using a protected password to access the directories. You must also define the directories that require authorization. In this example we'll protect the admin/ directory and authorize its access to user hacker ​(//user=hacker//):+Now you can configure the modules by specifying the debug level and method (plain) and the path to the file containing a list of names using a protected password to access the directories. You must also define the directories that require authorization. In this example we'll protect the admin/ directory and authorize its access to user tux (//user=tux//):
  
-<code>+<file>
 # Authentication for protected directory. # Authentication for protected directory.
 auth.debug = 2 auth.debug = 2
Line 96: Line 101:
 "​method"​ => "​basic",​ "​method"​ => "​basic",​
 "​realm"​ => "​Password protected area", "​realm"​ => "​Password protected area",
-"​require"​ => "user=hacker"+"​require"​ => "user=tux"
 ) )
 ) )
-</code>+</file>
  
-Finally, we now create the file containing the passwords, add a user and restart the server for testing. The basic syntax for the file is user:​password. You can create the file and add a user with the echo command or edit with your favorite text editor. To add hacker:root to the password file ///​etc/​lighttpd/​plain.passwd//:​+Finally, we now create the file containing the passwords, add a user and restart the server for testing. The basic syntax for the file is user:​password. You can create the file and add a user with the echo command or edit with your favorite text editor. To add tux:root to the password file ///​etc/​lighttpd/​plain.passwd//:​
  
 <​code>​ <​code>​
- # echo "hacker:root" > /​etc/​lighttpd/​plain.passwd+ # echo "tux:root" > /​etc/​lighttpd/​plain.passwd
  Or :  Or :
  # nano /​etc/​lighttpd/​plain.passwd  # nano /​etc/​lighttpd/​plain.passwd
 
en/handbook/webserver.txt · Last modified: 2012/12/24 17:52 by trixar_za