Welcome! Log In Create A New Profile

Advanced

Single virtualhost for HTTP and HTTPS

Posted by gandalf 
Single virtualhost for HTTP and HTTPS
January 19, 2024 09:16AM
Hi guys,
we host only HTTPS websites (or 99.9% are https).

I would like to keep just one virtual host for each domain, serving both HTTP and HTTPS, http is needed only for let's encrypt validation, everything else could be redirect to the https version.

I'm unable to do this.

Anyone is using such configuration ? I'm struggling forcing redirect for /.well-known ONLY if protocol is HTTP. If we are in HTTP and the url is /.well-known/ I need to change the document root to something dedicated to letsencrypt and then STOP any other execution. It doesn't work, if I have other redirect or location block, they are used anyway breaking the ssl validation

So i've tried to just use an HTTPS server block, one for each domain and then a default port 80 virtual host, but this doesn't work too.

Any idea ?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 166
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready