From 0691bcbd11897694a604f99fa58af6b4286c7195 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 29 Aug 2023 16:30:15 +0000 Subject: More examples, some fixes, some more doc Signed-off-by: Laurent Bercot --- examples/s6-rc/httpd-6-log/run | 2 +- examples/s6/httpd-4/log/notification-fd | 1 + examples/s6/httpd-4/log/run | 5 ++ examples/s6/httpd-4/notification-fd | 1 + examples/s6/httpd-4/run | 10 ++++ examples/s6/httpd-6/log/notification-fd | 1 + examples/s6/httpd-6/log/run | 5 ++ examples/s6/httpd-6/notification-fd | 1 + examples/s6/httpd-6/run | 10 ++++ examples/s6/httpsd-4/log/notification-fd | 1 + examples/s6/httpsd-4/log/run | 5 ++ examples/s6/httpsd-4/notification-fd | 1 + examples/s6/httpsd-4/run | 11 +++++ examples/s6/httpsd-6/log/notification-fd | 1 + examples/s6/httpsd-6/log/run | 5 ++ examples/s6/httpsd-6/notification-fd | 1 + examples/s6/httpsd-6/run | 11 +++++ examples/tipidee.conf | 84 +++++++++++++++++++++++--------- 18 files changed, 132 insertions(+), 24 deletions(-) create mode 100644 examples/s6/httpd-4/log/notification-fd create mode 100755 examples/s6/httpd-4/log/run create mode 100644 examples/s6/httpd-4/notification-fd create mode 100755 examples/s6/httpd-4/run create mode 100644 examples/s6/httpd-6/log/notification-fd create mode 100755 examples/s6/httpd-6/log/run create mode 100644 examples/s6/httpd-6/notification-fd create mode 100755 examples/s6/httpd-6/run create mode 100644 examples/s6/httpsd-4/log/notification-fd create mode 100755 examples/s6/httpsd-4/log/run create mode 100644 examples/s6/httpsd-4/notification-fd create mode 100755 examples/s6/httpsd-4/run create mode 100644 examples/s6/httpsd-6/log/notification-fd create mode 100755 examples/s6/httpsd-6/log/run create mode 100644 examples/s6/httpsd-6/notification-fd create mode 100755 examples/s6/httpsd-6/run (limited to 'examples') diff --git a/examples/s6-rc/httpd-6-log/run b/examples/s6-rc/httpd-6-log/run index 50d7448..5889b3e 100755 --- a/examples/s6-rc/httpd-6-log/run +++ b/examples/s6-rc/httpd-6-log/run @@ -2,4 +2,4 @@ s6-setuidgid wwwlog exec -c -s6-log -d3 t s1000000 n20 /var/log/httpd-46 +s6-log -d3 t s1000000 n20 /var/log/httpd-6 diff --git a/examples/s6/httpd-4/log/notification-fd b/examples/s6/httpd-4/log/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/examples/s6/httpd-4/log/notification-fd @@ -0,0 +1 @@ +3 diff --git a/examples/s6/httpd-4/log/run b/examples/s6/httpd-4/log/run new file mode 100755 index 0000000..51897c7 --- /dev/null +++ b/examples/s6/httpd-4/log/run @@ -0,0 +1,5 @@ +#!/bin/execlineb -S1 + +s6-setuidgid wwwlog +exec -c +s6-log -d3 t s1000000 n20 /var/log/httpd-4 diff --git a/examples/s6/httpd-4/notification-fd b/examples/s6/httpd-4/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/examples/s6/httpd-4/notification-fd @@ -0,0 +1 @@ +3 diff --git a/examples/s6/httpd-4/run b/examples/s6/httpd-4/run new file mode 100755 index 0000000..190392f --- /dev/null +++ b/examples/s6/httpd-4/run @@ -0,0 +1,10 @@ +#!/bin/execlineb -P + +fdmove -c 2 1 +backtick -E ip { pipeline { s6-dnsip4 example.com } head -n 1 } +s6-envuidgid www +cd /home/www +fdmove 1 3 +s6-tcpserver4 -v2 -1 -U -c 512 -- $ip 80 +s6-tcpserver-access -lexample.com -- +tipideed -v2 -- diff --git a/examples/s6/httpd-6/log/notification-fd b/examples/s6/httpd-6/log/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/examples/s6/httpd-6/log/notification-fd @@ -0,0 +1 @@ +3 diff --git a/examples/s6/httpd-6/log/run b/examples/s6/httpd-6/log/run new file mode 100755 index 0000000..5889b3e --- /dev/null +++ b/examples/s6/httpd-6/log/run @@ -0,0 +1,5 @@ +#!/bin/execlineb -S1 + +s6-setuidgid wwwlog +exec -c +s6-log -d3 t s1000000 n20 /var/log/httpd-6 diff --git a/examples/s6/httpd-6/notification-fd b/examples/s6/httpd-6/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/examples/s6/httpd-6/notification-fd @@ -0,0 +1 @@ +3 diff --git a/examples/s6/httpd-6/run b/examples/s6/httpd-6/run new file mode 100755 index 0000000..ae4dbba --- /dev/null +++ b/examples/s6/httpd-6/run @@ -0,0 +1,10 @@ +#!/bin/execlineb -P + +fdmove -c 2 1 +backtick -E ip { pipeline { s6-dnsip6 example.com } head -n 1 } +s6-envuidgid www +cd /home/www +fdmove 1 3 +s6-tcpserver6 -v2 -1 -U -c 512 -- $ip 80 +s6-tcpserver-access -lexample.com -- +tipideed -v2 -- diff --git a/examples/s6/httpsd-4/log/notification-fd b/examples/s6/httpsd-4/log/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/examples/s6/httpsd-4/log/notification-fd @@ -0,0 +1 @@ +3 diff --git a/examples/s6/httpsd-4/log/run b/examples/s6/httpsd-4/log/run new file mode 100755 index 0000000..770d831 --- /dev/null +++ b/examples/s6/httpsd-4/log/run @@ -0,0 +1,5 @@ +#!/bin/execlineb -S1 + +s6-setuidgid wwwlog +exec -c +s6-log -d3 t s1000000 n20 /var/log/httpsd-4 diff --git a/examples/s6/httpsd-4/notification-fd b/examples/s6/httpsd-4/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/examples/s6/httpsd-4/notification-fd @@ -0,0 +1 @@ +3 diff --git a/examples/s6/httpsd-4/run b/examples/s6/httpsd-4/run new file mode 100755 index 0000000..54be026 --- /dev/null +++ b/examples/s6/httpsd-4/run @@ -0,0 +1,11 @@ +#!/bin/execlineb -P + +fdmove -c 2 1 +backtick -E ip { pipeline { s6-dnsip4 example.com } head -n 1 } +s6-envuidgid www +export KEYFILE /etc/ssl/acme/private/example.com/key.pem +export CERTFILE /etc/ssl/acme/example.com/cert.pem +cd /home/www +fdmove 1 3 +s6-tlsserver -v -4 -1 -U -c 512 -K 30000 -- $ip 443 +tipideed -v2 -- diff --git a/examples/s6/httpsd-6/log/notification-fd b/examples/s6/httpsd-6/log/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/examples/s6/httpsd-6/log/notification-fd @@ -0,0 +1 @@ +3 diff --git a/examples/s6/httpsd-6/log/run b/examples/s6/httpsd-6/log/run new file mode 100755 index 0000000..a8281ad --- /dev/null +++ b/examples/s6/httpsd-6/log/run @@ -0,0 +1,5 @@ +#!/bin/execlineb -S1 + +s6-setuidgid wwwlog +exec -c +s6-log -d3 t s1000000 n20 /var/log/httpsd-6 diff --git a/examples/s6/httpsd-6/notification-fd b/examples/s6/httpsd-6/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/examples/s6/httpsd-6/notification-fd @@ -0,0 +1 @@ +3 diff --git a/examples/s6/httpsd-6/run b/examples/s6/httpsd-6/run new file mode 100755 index 0000000..652a354 --- /dev/null +++ b/examples/s6/httpsd-6/run @@ -0,0 +1,11 @@ +#!/bin/execlineb -P + +fdmove -c 2 1 +backtick -E ip { pipeline { s6-dnsip6 example.com } head -n 1 } +s6-envuidgid www +export KEYFILE /etc/ssl/acme/private/example.com/key.pem +export CERTFILE /etc/ssl/acme/example.com/cert.pem +cd /home/www +fdmove 1 3 +s6-tlsserver -v -6 -1 -U -c 512 -K 30000 -- $ip 443 +tipideed -v2 -- diff --git a/examples/tipidee.conf b/examples/tipidee.conf index f75a9cc..705b88c 100644 --- a/examples/tipidee.conf +++ b/examples/tipidee.conf @@ -1,41 +1,79 @@ -### Global definitions +### Global definitions. -# After 1 minute without a new request, exit -global read_timeout 60000 +# tipideed verbosity (overridden by the -v option). +# 0 is quiet, 1 is normal, 2+ is verbose. +# global verbosity 1 -# If the client fails to read a response for 1 minute, exit -global write_timeout 60000 +# tipideed will exit if the client does not send a new request +# after N milliseconds. +# 0 means no timeout. +# global read_timeout 0 -# If a CGI script takes more than 10s to run, kill it and respond 504 instead -global cgi_timeout 10000 +# tipideed will drop the connection if sending a response has +# not completed after N milliseconds. +# 0 means no timeout. +# global write_timeout 0 -# Serve .ini and .cfg files as plain text -content-type text/plain .ini .cfg +# tipideed will answer 504 ("Gateway Timeout") if a CGI program +# (including NPH) does not complete in N milliseconds. +# 0 means no timeout. +# global cgi_timeout 0 +# tipideed will refuse to serve POST requests if the client-provided +# data is larger than N bytes. +# global max_request_body_length 8192 -### Definitions for the example.com virtual domain -domain example.com +# tipideed will answer 502 ("Bad Gateway") if a CGI script's answer +# is larger than N bytes. (does not apply to NPH scripts) +# global max_cgi_body_length 4194304 -# CGI scripts called nph-foobar are considered non-parsed-headers -nph-prefix nph- +# When the requested URL is a directory, tipideed will serve the first +# existing file in this list. (Useful e.g. if you have an index.cgi program.) +# global index_file index.html -# CGI scripts live under /cgi-bin -cgi /cgi-bin/ +# You can define your own Content-Type mappings by file extension. +# The default mappings should work well for most servers. +# content-type text/html .html .htm -# Serve http://example.com/README as plain text -file-type /README text/plain + +### Definitions for the example.com domain +# domain example.com + +# If a CGI script under the current domain starts with this prefix, +# it will be considered a NPH script (non-parsable headers). +# nph-prefix nph- + +# If uncommented: every file under that directory will be considered +# a CGI script. +# cgi /cgi-bin/ + +# You can also declare that individual files are CGI scripts. +# cgi /index.cgi + +# If uncommented: every CGI script under that directory will be considered NPH. +# nph /cgi-bin/nph/ + +# You can also declare that individual scripts are NPH. +# nph /cgi-bin/basic.cgi + +# You can override the default Content-Type for individual files, +# no matter what extension they have. +# file-type /README text/plain # Redirect http://example.com/rickroll to a fan favorite video. # Make it temporary to avoid revealing the trick in the client. -redirect /rickroll 307 https://www.youtube.com/watch?v=dQw4w9WgXcQ +# redirect /rickroll 307 https://www.youtube.com/watch?v=dQw4w9WgXcQ # Permanently redirect http://example.com/community/foobar... requests # to https://example.org/foobar... -redirect /community/ 308 https://example.org +# redirect /community/ 308 https://example.org + +### Definitions for the example.org domain +# domain example.org -### Definitions for the example.org virtual domain -domain example.org +# example.org has the same NPH prefix +# nph-prefix nph- -nph-prefix nph- -cgi /cgi-bin/ +# example.org hosts CGI scripts in /cgi-bin as well +# cgi /cgi-bin/ -- cgit v1.2.3