httpd setup info?

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

httpd setup info?

John Long-4
Hi,

I read the man pages for httpd and httpd.conf but I remain clueless.

I would like to serve static content (directory listings and contents).
Must I use a chroot for httpd? If so, how do I set it up?

I have my content in /var/content/webserver/.. I would like httpd to
automatically index the contents.

Trying to massage the example/httpd.conf didn't work. I get a 403 when
I try to access my website.

# $OpenBSD: httpd.conf,v 1.18 2018/03/23 11:36:41 florian Exp $

server "example.com" {
        listen on * port 80
        listen on :: port 80
        location "/var/content/webserver/htdocs/*" {
                directory auto index
        }
}

Thanks

/jl

Reply | Threaded
Open this post in threaded view
|

Re: httpd setup info?

Edgar Pettijohn III-2

On Jul 2, 2018 5:58 AM, John Long <[hidden email]> wrote:

>
> Hi,
>
> I read the man pages for httpd and httpd.conf but I remain clueless.
>
> I would like to serve static content (directory listings and contents).
> Must I use a chroot for httpd? If so, how do I set it up?
>
> I have my content in /var/content/webserver/.. I would like httpd to
> automatically index the contents.
>
> Trying to massage the example/httpd.conf didn't work. I get a 403 when
> I try to access my website.
>
> # $OpenBSD: httpd.conf,v 1.18 2018/03/23 11:36:41 florian Exp $
>

Try:
chroot "/var/content"
server "example.com" {
listen on * port 80
listen on :: port 80
root "/webserver/htdocs"
directory auto index
}

I think the listen directive changed recently, so if it fails look into that as the cause.
>
> Thanks
>
> /jl
>

Reply | Threaded
Open this post in threaded view
|

Re: httpd setup info?

John Long-4
In reply to this post by John Long-4
On Mon, 2018-07-02 at 06:27 -0500, [hidden email] wrote:

> On Jul 2, 2018 5:58 AM, John Long <[hidden email]> wrote:
> >
> > Hi,
> >
> > I read the man pages for httpd and httpd.conf but I remain
> > clueless.
> >
> > I would like to serve static content (directory listings and
> > contents).
> > Must I use a chroot for httpd? If so, how do I set it up?
> >
> > I have my content in /var/content/webserver/.. I would like httpd
> > to
> > automatically index the contents.
> >
> > Trying to massage the example/httpd.conf didn't work. I get a 403
> > when
> > I try to access my website.
> >
> > # $OpenBSD: httpd.conf,v 1.18 2018/03/23 11:36:41 florian Exp $
> >
>
> Try:
> chroot "/var/content"
> server "example.com" {
> listen on * port 80
> listen on :: port 80
> root "/webserver/htdocs"
> directory auto index
> }

Thank you. What has to be in the chroot besides the content I want to
serve?

>
> I think the listen directive changed recently, so if it fails look
> into that as the cause.

Thanks, ok.

/jl

Reply | Threaded
Open this post in threaded view
|

Re: httpd setup info?

Edgar Pettijohn III-2
In reply to this post by John Long-4

On Jul 2, 2018 6:30 AM, John Long <[hidden email]> wrote:

>
> On Mon, 2018-07-02 at 06:27 -0500, [hidden email] wrote:
> > On Jul 2, 2018 5:58 AM, John Long <[hidden email]> wrote:
> > >
> > > Hi,
> > >
> > > I read the man pages for httpd and httpd.conf but I remain
> > > clueless.
> > >
> > > I would like to serve static content (directory listings and
> > > contents).
> > > Must I use a chroot for httpd? If so, how do I set it up?
> > >
> > > I have my content in /var/content/webserver/.. I would like httpd
> > > to
> > > automatically index the contents.
> > >
> > > Trying to massage the example/httpd.conf didn't work. I get a 403
> > > when
> > > I try to access my website.
> > >
> > > # $OpenBSD: httpd.conf,v 1.18 2018/03/23 11:36:41 florian Exp $
> > >
> >
> > Try:
> > chroot "/var/content"
> > server "example.com" {
> > listen on * port 80
> > listen on :: port 80
> > root "/webserver/htdocs"
> > directory auto index
> > }
>
> Thank you. What has to be in the chroot besides the content I want to
> serve?
>
Nothing for static content. If you add Perl or other such things you will have to add a lot of stuff.
> >
> > I think the listen directive changed recently, so if it fails look
> > into that as the cause.
>
> Thanks, ok.
>
> /jl
>

Reply | Threaded
Open this post in threaded view
|

Re: httpd setup info?

John Long-4
In reply to this post by John Long-4
On Mon, 2018-07-02 at 06:38 -0500, [hidden email] wrote:

> On Jul 2, 2018 6:30 AM, John Long <[hidden email]> wrote:
> >
> > On Mon, 2018-07-02 at 06:27 -0500, [hidden email] wrote:
> > > On Jul 2, 2018 5:58 AM, John Long <[hidden email]> wrote:
> > > >
> > > > Hi,
> > > >
> > > > I read the man pages for httpd and httpd.conf but I remain
> > > > clueless.
> > > >
> > > > I would like to serve static content (directory listings and
> > > > contents).
> > > > Must I use a chroot for httpd? If so, how do I set it up?
> > > >
> > > > I have my content in /var/content/webserver/.. I would like
> > > > httpd
> > > > to
> > > > automatically index the contents.
> > > >
> > > > Trying to massage the example/httpd.conf didn't work. I get a
> > > > 403
> > > > when
> > > > I try to access my website.
> > > >
> > > > # $OpenBSD: httpd.conf,v 1.18 2018/03/23 11:36:41 florian Exp $
> > > >
> > >
> > > Try:
> > > chroot "/var/content"
> > > server "example.com" {
> > > listen on * port 80
> > > listen on :: port 80
> > > root "/webserver/htdocs"
> > > directory auto index
> > > }
> >
> > Thank you. What has to be in the chroot besides the content I want
> > to
> > serve?
> >
>
> Nothing for static content. If you add Perl or other such things you
> will have to add a lot of stuff.

Ah great, thanks, I'll try it asap.

/jl

Reply | Threaded
Open this post in threaded view
|

Re: httpd setup info?

John Long-4
In reply to this post by John Long-4
On Mon, 2018-07-02 at 06:27 -0500, [hidden email] wrote:
> chroot "/var/content"
> server "example.com" {
> listen on * port 80
> listen on :: port 80
> root "/webserver/htdocs"
> directory auto index
> }

Thanks, this works. Actually I pushed things down one level and used

chroot "/var/content/webserver"

and then I can take the default for the root macro and omit it.


When I click on a PDF doc file, my browser (on Linux) wants to download
it instead of opening it. What's the appropriate way to let the browser
know it should open it in Acrobat (or default app set in the browser)
instead of downloading the file?

/jl

Reply | Threaded
Open this post in threaded view
|

Re: httpd setup info?

Il Ka
>>What's the appropriate way to let the browser
>> know it should open it in Acrobat
See "Content-Disposition" header.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition

It tells client to download document or open it inline.
Reply | Threaded
Open this post in threaded view
|

Re: httpd setup info?

John Long-4
On Mon, 2018-07-02 at 17:18 +0300, IL Ka wrote:
> >>What's the appropriate way to let the browser
> >> know it should open it in Acrobat
> See "Content-Disposition" header.
> https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Dis
> position
>
> It tells client to download document or open it inline.

Thanks, how do I translate this info into something httpd can use?

/jl

Reply | Threaded
Open this post in threaded view
|

Re: httpd setup info?

John Long-4
In reply to this post by John Long-4
What userid does httpd run under?

I have some kind of permission problem, httpd can't serve some of the
content.

Thank you.

/jl

Reply | Threaded
Open this post in threaded view
|

Re: httpd setup info?

Scott Vanderbilt-2
In reply to this post by John Long-4
On 7/2/2018 8:03 AM, John Long wrote:

> On Mon, 2018-07-02 at 17:18 +0300, IL Ka wrote:
>>>> What's the appropriate way to let the browser
>>>> know it should open it in Acrobat
>> See "Content-Disposition" header.
>> https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Dis
>> position
>>
>> It tells client to download document or open it inline.
>
> Thanks, how do I translate this info into something httpd can use?

https://man.openbsd.org/httpd.conf#TYPES

Reply | Threaded
Open this post in threaded view
|

Re: httpd setup info?

Scott Vanderbilt-2
In reply to this post by John Long-4
On 7/2/2018 8:05 AM, John Long wrote:
> What userid does httpd run under?
>
> I have some kind of permission problem, httpd can't serve some of the
> content.

ps aux|grep httpd

Reply | Threaded
Open this post in threaded view
|

Re: httpd setup info?

John Long-4
In reply to this post by Scott Vanderbilt-2
On Mon, 2018-07-02 at 08:10 -0700, Scott Vanderbilt wrote:

> On 7/2/2018 8:03 AM, John Long wrote:
> > On Mon, 2018-07-02 at 17:18 +0300, IL Ka wrote:
> > > > > What's the appropriate way to let the browser
> > > > > know it should open it in Acrobat
> > >
> > > See "Content-Disposition" header.
> > > https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content
> > > -Dis
> > > position
> > >
> > > It tells client to download document or open it inline.
> >
> > Thanks, how do I translate this info into something httpd can use?
>
> https://man.openbsd.org/httpd.conf#TYPES

<facepalm> Thanks/sorry. I saw that somewhere and couldn't remember
where until this recent clue-stick ;)

/jl

Reply | Threaded
Open this post in threaded view
|

Re: httpd setup info?

John Long-4
In reply to this post by Scott Vanderbilt-2
On Mon, 2018-07-02 at 08:11 -0700, Scott Vanderbilt wrote:
> On 7/2/2018 8:05 AM, John Long wrote:
> > What userid does httpd run under?
> >
> > I have some kind of permission problem, httpd can't serve some of
> > the
> > content.
>
> ps aux|grep httpd

Thanks again.

/jl