Friday, March 02, 2018

Re: httpd howto redirect port 80 to 443 in vm

Put into /etc/httpd.conf :

types { include "/usr/share/misc/mime.types" }

server "default" {

        listen on * tls port 443
        tls certificate "/etc/letsencrypt/live/example.com/fullchain.pem"
        tls key "/etc/letsencrypt/live/example.com/privkey.pem"

        root "/htdocs/example.com"

}

server "www.example.com" {

        alias "example.com"

        listen on * port 80
        block return 301 "https://$SERVER_NAME$REQUEST_URI"

}

Le 02/03/2018 à 15:51, Base Pr1me a écrit :
> I simply have a block in my httpd.conf for my redirects:
>
> server "example.com" {
> listen on $ext_if port 80
> alias "www.example.com"
> block return 301 "https://example.com/"
> }
>
> On Fri, Mar 2, 2018 at 7:40 AM, Solène Rapenne <solene@perso.pw> wrote:
>
>> Le 2018-03-02 15:33, Matt M a écrit :
>>
>>> Why not use a .htaccess redirect?
>>>
>>> https://www.sslshopper.com/apache-redirect-http-to-https.html
>>>
>> .htaccess file is a feature of Apache web server while we are
>> talking about httpd.
>>
>>

No comments:

Post a Comment