Hi!

I suppose you can script one config into ”httpd.foo.net”, another to ”
httpd.bar.com” etc.  and then include all individual files into httpd.conf
with the keyword ”include”?

BR, Andreas

fre 22 dec. 2017 kl. 03:39 skrev Ryan Flannery <[email protected]>:

> Hi, I'm curious if there's a more concise/preferred way to accomplish the
> below. I'm hosting a number of sites that want to prefer https over http
> and strip any www subdomain from urls.
>
> E.g.
> www.foo.com/* -> https://foo.com/*
> https://www.foo.com/* -> https://foo.com/*
>
> I have this working (used acme-client to setup ssl - that was a breeze!)
> using the following setup, but I'm curious if there's a more
> concise/preferred way. I'll need to configure this for a number of sites,
> and would probably script the config.
>
> The first two server blocks setup the redirects, and the third is for the
> actual site.
>
> server "foo.net" {
>    alias "www.foo.net"
>    listen on * port 80
>    block return 301 "https://foo.net$REQUEST_URI";
> }
> server "www.foo.net" {
>    listen on * tls port 443
>    tls certificate "/etc/ssl/foo.net.fullchain.pem"
>    tls key "/etc/ssl/private/foo.net.key"
>    block return 301 "https://foo.net$REQUEST_URI";
> }
> server "foo.net" {
>    listen on * tls port 443
>    tls certificate "/etc/ssl/foo.net.fullchain.pem"
>    tls key "/etc/ssl/private/foo.net.key"
>    root "/htdocs/foo.net"
> }
>
> Cheers,
> -Ryan
>

Reply via email to