TetaTricks/chap/webserver.tex

94 lines
3.3 KiB
TeX

%
% Chapitre un peu en vrac :)
%
\chapter{Web servers}
% ==============================================================
\section{Apache, Nginx} \index{Apache} \index{nginx}
Apache (\textsl{A patchy server} et Nginx sont de grands classiques,
voire même, dans le cas d'Apache, un grand ancien.
Que nous ne verrons pas pour le moment. Je vais plutôt me concentrer
sur un autre serveur : \texttt{lighthttp}, pour passer ensuite à quelque
chose d'encore plus bas-niveau qui demandera quelques connaissances en C.
% ==============================================================
\section{Lighttpd} \index{Lighttpd}
Un outsider ? Non, pas vraiment. Probablement plus léger que
les classiques, il a quelques fonctions assez interessantes.
Je vais faire un rapide survol des \textsl{tricks} à connaitre
pour une mise en œuvre de bon aloi. Et pour ça, je vais
d'abord me concentrer sur un cas précis~:
l'exécution de scripts CGI\index{CGI} écrits en Perl\index{Perl}
depuis le répertoire \texttt{\$HOME/public\_html/} des yusers.
\begin{verbatim}
root@ramen:~# lighty-enable-mod userdir
Enabling userdir: ok
Run "service lighttpd force-reload" to enable changes
root@ramen:~# service lighttpd force-reload
root@ramen:~#
\end{verbatim}
\textbf{Q:} Sur une installation fraiche, la racine du site est
en erreur 403\index{403} ?
\textbf{R:} Par défaut le listing des répertoires vides
(sans \texttt{index.html}) est interdit. Pour changer ça, il faut
\texttt{\# lighttpd-enable-mod dir-listing} et
\texttt{\# service lighttpd force-reload}, voilà.
Question : comment forcer le \texttt{Content-Type} pour un type particulier
de fichier ? Par exemple text/plain pour les fichiers \texttt{.POV} ?
% ------------------------------------------------
\subsection{Filtrages}
In case you need to do this with lighttpd (you can have multiple of
these for each useragent you want to match, or you can make one big regex
if you want):
\texttt{\$HTTP["useragent"] =~ "Amazonbot" \{ url.access-deny = ("") \}}
% ==============================================================
\section{Custom made}
\begin{verbatim}
tth@ramen:~/Houba/Fractales90$ apt show libmicrohttpd12
Package: libmicrohttpd12
Version: 0.9.72-2
Priority: optional
Section: libs
Source: libmicrohttpd
Maintainer: Daniel Baumann <daniel.baumann@progress-linux.org>
Installed-Size: 211 kB
Depends: libc6 (>= 2.17), libgnutls30 (>= 3.7.0)
Homepage: https://www.gnu.org/software/libmicrohttpd/
Tag: role::shared-lib
Download-Size: 109 kB
APT-Sources: http://deb.debian.org/debian bullseye/main amd64 Packages
Description: library embedding HTTP server functionality
GNU libmicrohttpd is a small C library that is supposed to make it
easy to run an HTTP server as part of another application.
Key features that distinguish GNU Libmicrohttpd from other
projects are:
* C library: fast and small
* API is simple, expressive and fully reentrant
* Implementation is HTTP 1.1 compliant
* HTTP server can listen on multiple ports
* Four different threading models (select, poll, pthread, thread pool)
* Support for IPv6
* Support for SHOUTcast
* Support for incremental processing of POST data (optional)
* Support for basic and digest authentication (optional)
* Support for SSL3 and TLS
\end{verbatim}
% ==============================================================