Score:0

How to setup diffferent location properties on nginx server block configuration files?

je flag

I'm very new to configuring a server. I followed a tutorial which indicates denying all requests not targeted to root, which makes perfect sense:

server {
        listen 80;
        listen [::]:80;

        root /var/www/yourdomain.com/html;
        index index.html index.htm index.nginx-debian.html;

        server_name yourdomain.com www.nelsonserpa.com;

        location / {
                try_files $uri $uri/ =404;
        }
}

However, I need o install certbot's tls/ssl to enable https. And certbot is failing because file location is not accessible. I needs to access mydomain.com/.well-known/acme-challenge/<credential>

It seems I need to set location to:

        location ~ /.well-known/ {  
          allow all;
        }

How do I keep refusing connections elsewhere but this specific folder?

Score:0
je flag

THis is the solution for the infamous certbot 404 issue

server {

        root /var/www/yoursite.com/html;
        index index.html index.htm index.nginx-debian.html;

        server_name yoursite.com www.yoursite.com;

        location / {
                try_files $uri $uri/ =404;
        }

        location /.well-known/acme-challenge {
          default_type text/plain;
          root /etc/letsencrypt/webroot;
        }
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.