Welcome! Log In Create A New Profile

Advanced

avoid redirect

Mik J via nginx
December 02, 2018 05:04PM
Hello,

I'd like to be able to offer let's encrypt in port 80 only and redirect everything else to port 443

server {
        listen 80;
        listen [::]:80;
        listen 443;
        listen [::]:443;
        server_name http://www.mydomain.org blog.mydomain.org;
        location ^~ /.well-known/acme-challenge { default_type "text/plain"; root /var/www/letsencrypt; }
        location = /.well-known/acme-challenge/ { return 404; }
        return 301 https:// mydomain.org;
}

My problem is that everything is redirected and I cannot access a file in /var/www/letsencrypt/.well-known/acme-challenge
When I comment the return 301 it works but I loose the redirection.
It seems to me that nginx parses everything where I would expect it to stop at
location ^~ /.well-known/acme-challenge { default_type "text/plain"; root /var/www/letsencrypt; }

Does anyone know the trick ?
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

avoid redirect

Mik J via nginx December 02, 2018 05:04PM

Re: avoid redirect

Moshe Katz December 02, 2018 05:10PM

Re: avoid redirect

Moshe Katz December 02, 2018 05:58PM

Re: avoid redirect

Mik J via nginx December 02, 2018 06:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 87
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready