> On 22 Jun 2018, at 22:20, Sebastian Benoit <be...@openbsd.org> wrote:
> 
> Jason McIntyre(j...@kerhand.co.uk) on 2018.06.22 19:38:55 +0100:
>>> On Fri, Jun 22, 2018 at 12:08:07AM +0200, Mischa wrote:
>>> Hi tech@,
>>> 
>>> Changed httpd.conf.5 to be more consistent with IPs used, all documentation 
>>> IPs now.
>>> And added a couple of examples. 2 for dyamic pages, cgi and php.
>>> One fairly common used rewrite rule for things like wordpress.
>>> 
>>> Mischa
>>> 
>> 
>> hi.
>> 
>> the diff reads ok to me, but i cannot easily verify it because it does
>> not apply cleanly.
> 
> The parts that dont apply are already commited parts from reyks rewrite
> diff. They can be ignored.

My mistake. Will take a clean checkout. 

> However i dont know if we want all those examples. We will get them in
> package readmes eventually.

I can also check out the pkg-readmes and expand those. As the php ones don’t 
have any mention about the httpd.conf needs. Will check out Wordpress as well.

I do think adding extra examples can be helpful as its probably a knee jerk 
reaction for people to go to the man page, or man.openbsd.org. 

Mischa


> 
> Reyk?
> 
>> 
>> reyk?
>> 
>> jmc
>> 
>>> Index: httpd.conf.5
>>> ===================================================================
>>> RCS file: /cvs/src/usr.sbin/httpd/httpd.conf.5,v
>>> retrieving revision 1.100
>>> diff -u -p -r1.100 httpd.conf.5
>>> --- httpd.conf.5    18 Jun 2018 06:04:25 -0000    1.100
>>> +++ httpd.conf.5    21 Jun 2018 21:55:38 -0000
>>> @@ -97,7 +97,7 @@ Macros are not expanded inside quotes.
>>> .Pp
>>> For example:
>>> .Bd -literal -offset indent
>>> -ext_ip="10.0.0.1"
>>> +ext_ip="203.0.113.1"
>>> server "default" {
>>>    listen on $ext_ip port 80
>>> }
>>> @@ -198,6 +198,8 @@ argument can be used with return codes i
>>> .Sq Location:
>>> header for redirection to a specified URI.
>>> .Pp
>>> +It is possible to rewrite the request to redirect it to a different
>>> +external location.
>>> The
>>> .Ar uri
>>> may contain predefined macros that will be expanded at runtime:
>>> @@ -396,10 +398,10 @@ the
>>> using pattern matching instead of shell globbing rules,
>>> see
>>> .Xr patterns 7 .
>>> -The pattern may contain captures that can be used in the
>>> -.Ar uri
>>> -of an enclosed
>>> +The pattern may contain captures that can be used in an enclosed
>>> .Ic block return
>>> +or
>>> +.Ic request rewrite
>>> option.
>>> .It Oo Ic no Oc Ic log Op Ar option
>>> Set the specified logging options.
>>> @@ -462,6 +464,19 @@ in a location.
>>> Configure the options for the request path.
>>> Valid options are:
>>> .Bl -tag -width Ds
>>> +.It Oo Ic no Oc Ic rewrite Ar path
>>> +Enable or disable rewriting of the request.
>>> +Unlike the redirection with
>>> +.Ic block return ,
>>> +this will change the request path internally before
>>> +.Nm httpd
>>> +makes a final decision about the matching location.
>>> +The
>>> +.Ar path
>>> +argument may contain predefined macros that will be expanded at runtime.
>>> +See the
>>> +.Ic block return
>>> +option for the list of supported macros.
>>> .It Ic strip Ar number
>>> Strip
>>> .Ar number
>>> @@ -699,7 +714,7 @@ server "www.b.example.com" {
>>> }
>>> 
>>> server "intranet.example.com" {
>>> -    listen on 10.0.0.1 port 80
>>> +    listen on 192.0.2.1 port 80
>>>    root "/htdocs/intranet.example.com"
>>> }
>>> .Ed
>>> @@ -709,12 +724,43 @@ Simple redirections can be configured wi
>>> directive:
>>> .Bd -literal -offset indent
>>> server "example.com" {
>>> -    listen on 10.0.0.1 port 80
>>> +    listen on 203.0.113.1 port 80
>>>    block return 301 "http://www.example.com$REQUEST_URI";
>>> }
>>> 
>>> server "www.example.com" {
>>> -    listen on 10.0.0.1 port 80
>>> +    listen on 203.0.113.1 port 80
>>> +}
>>> +.Ed
>>> +.Pp
>>> +Serving dynamic pages can be defined with the 
>>> +.Ic location
>>> +directive:
>>> +.Bd -literal -offset indent
>>> +server "www.example.com" {
>>> +    listen on * port 80
>>> +    location "/*.cgi*" {
>>> +        fastcgi
>>> +        root "/cgi-bin/"
>>> +    }
>>> +    location "/*.php*" {
>>> +        fastcgi socket "/run/php-fpm.sock"
>>> +    }
>>> +}
>>> +.Ed
>>> +.Pp
>>> +The request can also be rewritten with the
>>> +.Ic request rewrite
>>> +directive:
>>> +.Bd -literal -offset indent
>>> +server "www.example.com" {
>>> +    listen on * port 80
>>> +    location match "/old/(.*)" {
>>> +        request rewrite "/new/%1"
>>> +    }
>>> +    location match "/([%a%d]+)" {
>>> +        request rewrite "/dynamic/index.php?q=%1"
>>> +    }
>>> }
>>> .Ed
>>> .Sh SEE ALSO
>>> 
>> 
> 

Reply via email to