<html><head><title>web_server (Editing Mon Oct 13 13:45:39 EDT 2008 version)</title><META http-equiv="Content-Type" content="text/html; charset=utf-8"></head><!-- FFFFE9 is acme yellow; FFFFE9 is as close as you can get to it before charon decides to use grey instead of map entry 254 --><body bgcolor="#FFFFE9" link="#0000AA" alink="#0000AA" vlink="#0000AA"><center><font size=+2><b>web_server</b></font> (Editing Mon Oct 13 13:45:39 EDT 2008 version)</center><p>For information on editing, see thedescription of <a href="../0">Plan 9 wiki syntax</a>.<p><form action="/magic/wikipost" method="post"><table><tr><td valign=top><input type="submit" name="x" value="Put"></td><td><table><tr><td align=right>(optional) Comment:</td><td><input type="text" name="comment" value="" cols=40></td></tr><tr><td align=right>(optional) Email:</td><td><input type="text" name="author" value="" cols=40></td></tr></table><input type="hidden" name="title" value="web_server"><input type="hidden" name="version" value="1223919939"><input type="hidden" name="service" value="plan9"><input type="hidden" name="base" value="/wiki/plan9"><p><textarea name="text" wrap="virtual" cols="80" rows="25">The Plan 9 web server httpd(8) has some interesting features. It alsokept me scratching my head all day getting it going so I thought I'dshare a few things.When the httpd runs it sets itself to user "none" and runs newns(2)and then addns(2) using the namespace provided on the command line(or /lib/namespace.httpd if you didn't give it a -n). This means thatwhatever you supply for the namespace file has to exist in the newnamespace. ip/httpd/httpd -n /cfg/$sysname/namespace.httpd was mysolution.While experimenting I had the problem of how to kill a process ownedby none, here's how to do it :! p = `{ps | grep httpd}! chmod 777 /proc/$p(2) ^/note && echo kill > /proc/$p(2) ^/noteI'm assuming only one program called httpd is running, of course.For extra fun ip/httpd/mirror was missing from my distribution (Sept07) and I didn't notice for ages.momo here is a Unix box running u9fs -a none and I'm using a terminalto play on so termrc it iscat /cfg/$sysname/termrc! fn start_httpd {! rfork! bind /n/momo/home/plan9/httpd /usr! bind /usr/httpd.rewrite /sys/lib/httpd.rewrite! ip/httpd/httpd -n /cfg/$sysname/namespace.httpd! }! ! 9fs momo! ! start_httpd &The folder /n/momo/home/plan9/httpd has in it :! bin/! web/! httpd.rewritecat /cfg/$sysname/namespace.httpd! mount /srv/momo /n/momo! bind /n/momo/home/plan9/httpd/bin /bin/ip/httpdSo now my /magic/ files are kept on momo so I don't pollute/bin/ip/httpdI also found a bug with vhosts and submitted a patch(1)httpd-post-port because vhosts running on non-default port wereimpossible as the :port was being stripped when the vhosts wereparsed but not when matching http requests. Leaving the :port on isthe correct behaviour according to RFC 2616 14.23.</textarea><p></td></table></form><hr><table width=100%><tr><td valign=center align=left></td><td valign=center align=right><a href="../about.html">About the server</a>| <a href="http://plan9.bell-labs.com/plan9"><img src="http://plan9.bell-labs.com/plan9/img/power36.gif"alt="Powered by Plan 9"></a></td></tr></table></html></body>
<html>
<head>
<title>web_server (Editing Mon Oct 13 13:45:39 EDT 2008 version)</title>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<!-- FFFFE9 is acme yellow; FFFFE9 is as close as
you can get to it before charon decides to use
grey instead of map entry 254 -->
<body bgcolor="#FFFFE9" link="#0000AA" alink="#0000AA" vlink="#0000AA">
<center>
<font size=+2><b>web_server</b></font> (Editing Mon Oct 13 13:45:39 EDT 2008 version)
</center>
<p>
For information on editing, see the
description of
<a href="../0">Plan 9 wiki syntax</a>.
<p>
<form action="/magic/wikipost" method="post">
<table><tr><td valign=top>
<input type="submit" name="x" value="Put"></td><td>
<table>
<tr><td align=right>(optional) Comment:</td><td><input type="text" name="comment" value="" cols=40></td></tr>
<tr><td align=right>(optional) Email:</td><td><input type="text" name="author" value="" cols=40></td></tr>
</table>
<input type="hidden" name="title" value="web_server">
<input type="hidden" name="version" value="1223919939">
<input type="hidden" name="service" value="plan9">
<input type="hidden" name="base" value="/wiki/plan9">
<p>
<textarea name="text" wrap="virtual" cols="80" rows="25">
The Plan 9 web server httpd(8) has some interesting features. It also
kept me scratching my head all day getting it going so I thought I'd
share a few things.
When the httpd runs it sets itself to user "none" and runs newns(2)
and then addns(2) using the namespace provided on the command line
(or /lib/namespace.httpd if you didn't give it a -n). This means that
whatever you supply for the namespace file has to exist in the new
namespace. ip/httpd/httpd -n /cfg/$sysname/namespace.httpd was my
solution.
While experimenting I had the problem of how to kill a process owned
by none, here's how to do it :
! p = `{ps | grep httpd}
! chmod 777 /proc/$p(2) ^/note && echo kill > /proc/$p(2) ^/note
I'm assuming only one program called httpd is running, of course.
For extra fun ip/httpd/mirror was missing from my distribution (Sept
07) and I didn't notice for ages.
momo here is a Unix box running u9fs -a none and I'm using a terminal
to play on so termrc it is
cat /cfg/$sysname/termrc
! fn start_httpd {
! rfork
! bind /n/momo/home/plan9/httpd /usr
! bind /usr/httpd.rewrite /sys/lib/httpd.rewrite
! ip/httpd/httpd -n /cfg/$sysname/namespace.httpd
! }
!
! 9fs momo
!
! start_httpd &
The folder /n/momo/home/plan9/httpd has in it :
! bin/
! web/
! httpd.rewrite
cat /cfg/$sysname/namespace.httpd
! mount /srv/momo /n/momo
! bind /n/momo/home/plan9/httpd/bin /bin/ip/httpd
So now my /magic/ files are kept on momo so I don't pollute
/bin/ip/httpd
I also found a bug with vhosts and submitted a patch(1)
httpd-post-port because vhosts running on non-default port were
impossible as the :port was being stripped when the vhosts were
parsed but not when matching http requests. Leaving the :port on is
the correct behaviour according to RFC 2616 14.23.
</textarea><p>
</td>
</table>
</form>
<hr>
<table width=100%><tr>
<td valign=center align=left>
</td><td valign=center align=right>
<a href="../about.html">About the server</a>
|
<a href="http://plan9.bell-labs.com/plan9"
><img src="http://plan9.bell-labs.com/plan9/img/power36.gif"
alt="Powered by Plan 9"></a>
</td>
</tr></table>
</html>
</body>