lighttpd
Розбіжності
Тут показані розбіжності між вибраною ревізією та поточною версією сторінки.
| Порівняння попередніх версійПопередня ревізіяНаступна ревізія | Попередня ревізія | ||
| lighttpd [2013/11/07 12:14] – wombat | lighttpd [2016/02/18 20:26] (поточний) – SSL & virtual hosts wombat | ||
|---|---|---|---|
| Рядок 1: | Рядок 1: | ||
| + | ====== Lighttpd ====== | ||
| + | |||
| + | ===== SSL ===== | ||
| + | |||
| + | http:// | ||
| + | |||
| + | ===== Виртуальные серверы ===== | ||
| + | |||
| + | FIXME | ||
| + | |||
| + | ====== Запрет доступа к определённым файлам ====== | ||
| + | |||
| + | |||
| + | [[http:// | ||
| + | |||
| + | It is easy in lighttpd to deny access to a few types of files using mod_access: | ||
| + | |||
| + | url.access-deny = ( " | ||
| + | |||
| + | But what if you want to allow access to only a few types of files, and deny access to all others? In the example below, we allow access to common static file types, and deny access to all other files: | ||
| + | |||
| + | |||
| + | $HTTP[" | ||
| + | url.access-deny = ( "" | ||
| + | } | ||
| + | |||
| + | This will cause all URLs that don't match the pattern to be denied. Note that all non-matching URLs will return 403 Forbidden, non-existent files will not return 404 Not Found. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== mod_access ===== | ||
| + | |||
| + | |||
| + | [[http:// | ||
| + | |||
| + | == Description == | ||
| + | |||
| + | The access module is used to deny access to files. | ||
| + | |||
| + | == Options == | ||
| + | |||
| + | **url.access-deny** | ||
| + | |||
| + | Denies access to all files with any of given trailing path names. | ||
| + | |||
| + | Default value:empty | ||
| + | |||
| + | **access.deny-all** | ||
| + | |||
| + | Denies access to all files. | ||
| + | |||
| + | Note: access.deny-all should be used with a conditional to limit it (only from lighty 1.5x) | ||
| + | |||
| + | == Usage examples == | ||
| + | |||
| + | You might want to deny access to all files ending with a tilde (~) or .inc because of: | ||
| + | |||
| + | Text editors often use a trailing tilde for backup files. | ||
| + | And the .inc extension is often used for include files with code. | ||
| + | url.access-deny | ||
| + | |||
| + | |||
| + | url.access-deny = ( " | ||
| + | |||
| + | access.deny-all usage | ||
| + | |||
| + | |||
| + | $PHYSICAL[" | ||
| + | access.deny-all = " | ||
| + | } | ||
| + | |||
| + | Directory deny access | ||
| + | |||
| + | |||
| + | $PHYSICAL[" | ||
| + | access.deny-all = " | ||
| + | } | ||
| + | |||
| + | Directory deny access (1.4x versions) | ||
| + | |||
| + | |||
| + | $HTTP[" | ||
| + | url.access-deny = ("" | ||
| + | } | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Серверные сценарии ====== | ||
| + | |||
| + | === Module: mod_cgi === | ||
| + | |||
| + | [[http:// | ||
| + | |||
| + | The CGI-Module | ||
| + | Description | ||
| + | Options | ||
| + | Examples | ||
| + | |||
| + | == Description == | ||
| + | |||
| + | CGI programs allow you to enhance the functionality of the server in a very straight-forward and simple way. | ||
| + | |||
| + | Note that to see stderr output from CGI processes, you need to set | ||
| + | |||
| + | server.breakagelog = "/ | ||
| + | or similar. | ||
| + | |||
| + | == Options == | ||
| + | |||
| + | **cgi.execute-x-only** | ||
| + | |||
| + | requires +x for cgi scripts if enabled. | ||
| + | |||
| + | **cgi.assign** | ||
| + | |||
| + | file-extensions that are handled by a CGI program | ||
| + | |||
| + | cgi.assign = ( " | ||
| + | " | ||
| + | For PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini. | ||
| + | |||
| + | To get the old cgi-bin behavior of apache: | ||
| + | |||
| + | #Note: make sure that mod_alias is loaded if you use this: | ||
| + | alias.url += ( "/ | ||
| + | $HTTP[" | ||
| + | cgi.assign = ( "" | ||
| + | } | ||
| + | | ||
| + | **cgi.execute-all** | ||
| + | |||
| + | In 1.5.0 and later you can use: | ||
| + | |||
| + | $PHYSICAL[" | ||
| + | cgi.execute-all = " | ||
| + | } | ||
| + | which does the same thing as cgi.assign = ("" | ||
| + | Examples | ||
| + | To setup an executable which can run on its own (e.g. binaries, scripts with a shebang line) you just don't specify a handler for the extension: | ||
| + | |||
| + | cgi.assign = ( " | ||
| + | If the file has no extension keep in mind that lighttpd matches not the extension itself but the right part of the URL: | ||
| + | |||
| + | cgi.assign = ( "/ | ||
| + | |||
| + | redmine.lighttpd.net | ||
| + | |||
| + | ====== Доступ по паролю ====== | ||
| + | |||
| + | Согласно [[http:// | ||
| + | Поэтому поскольку в нашей конфигурации модуль **mod_fastcgi** загружается в файле | ||
| + | ''/ | ||
| + | ''/ | ||
| + | |||
| + | <file conf "/ | ||
| + | # Из файла: | ||
| + | # / | ||
| + | |||
| + | server.modules | ||
| + | |||
| + | auth.backend | ||
| + | auth.backend.htdigest.userfile = "/ | ||
| + | </ | ||
| + | |||
| + | В файле ''/ | ||
| + | Чтобы добавить нового пользователя, | ||
| + | |||
| + | htdigest / | ||
| + | |||
| + | Эта команда создаст пользователя //admin// для запроса //" | ||
| + | Т.е. когда веб-сервер будет выдавать указанную строку запроса пароля, | ||
| + | |||
| + | Следует иметь в виду, что пары " | ||
| + | |||
| + | Ниже показан пример такой настройки для адреса ''/ | ||
| + | |||
| + | <file conf "/ | ||
| + | $HTTP[" | ||
| + | |||
| + | server.document-root = "/ | ||
| + | accesslog.filename = "/ | ||
| + | server.error-handler-404 = "/ | ||
| + | |||
| + | $HTTP[" | ||
| + | auth.require = ( "" | ||
| + | ( | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | ) | ||
| + | ) | ||
| + | } | ||
| + | } | ||
| + | </ | ||
