Improve the apache rewrite instructions.

Specifically, mention the `NE' flag and point at the apache "current"
version of the page.
This commit is contained in:
Eli Barzilay 2011-02-08 11:48:37 -05:00
parent 6a220d7d69
commit 42eb0a9e88

View File

@ -6,37 +6,48 @@
@section{How do I use Apache with the Racket Web Server?} @section{How do I use Apache with the Racket Web Server?}
You may want to put Apache in front of your Racket Web Server application. You may want to put Apache in front of your Racket Web Server
Apache can rewrite and proxy requests for a private (or public) Racket Web Server: application. Apache can rewrite and proxy requests for a private (or
public) Racket Web Server:
@verbatim{ @verbatim{
RewriteRule ^(.*)$ http://localhost:8080/$1 [P] RewriteEngine on
RewriteRule ^(.*)$ http://localhost:8080/$1 [P,NE]
} }
The first argument to @exec{RewriteRule} is a match pattern. The second is how to rewrite the URL. The first argument to @exec{RewriteRule} is a match pattern. The second
The @exec{[P]} flag instructs Apache to proxy the request. If you do not include this, Apache will is how to rewrite the URL. The bracketed part contains flags that
return an HTTP Redirect response and the client should make a second request. specify the type of rewrite, in this case the @litchar{P} flag instructs
Apache to proxy the request. (If you do not include this, Apache will
return an HTTP Redirect response and the client will make a second
request to @litchar{localhost:8080} which will not work on a different
machine.) In addition, the @litchar{NE} flag is needed to avoid
escaping parts of the URL --- without it, a @litchar{;} is escaped as
@litchar{%3B} which will break the proxied request.
See Apache's documentation for more details on @link["http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriterule"]{RewriteRule}. See Apache's documentation for more details on
@link["http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule"]{RewriteRule}.
@section{Can the server create a PID file?} @section{Can the server create a PID file?}
The server has no option for this, but you can add it very easily. There's two techniques. The server has no option for this, but you can add it very
easily. There's two techniques.
First, if you use a UNIX platform, in your shell startup script you can use First, if you use a UNIX platform, in your shell startup script you can use
@verbatim{ @verbatim{
echo $$ > PID echo $$ > PID
exec run-web-server exec run-web-server
} }
Using @exec{exec} will reuse the same process, and therefore, the PID file will be accurate. Using @exec{exec} will reuse the same process, and therefore, the PID
file will be accurate.
Second, if you want to make your own Racket start-up script, you can write: Second, if you want to make your own Racket start-up script, you can write:
@(require (for-label mzlib/os)) @(require (for-label mzlib/os))
@racketblock[ @racketblock[
(require mzlib/os) (require mzlib/os)
(with-output-to-file _your-pid-file (lambda () (write (getpid)))) (with-output-to-file _your-pid-file (lambda () (write (getpid))))
(_start-server) (_start-server)
] ]
@section[#:tag "faq:https"]{How do I set up the server to use HTTPS?} @section[#:tag "faq:https"]{How do I set up the server to use HTTPS?}