I did some coding to get the nginx config file working.
My objective is to allow all .well-known folder and subfolders leaving the rest with basic auth, limit_req and laravel compatible.
The problem now with let's Encrypt is that it is not renewing the cert because the route .well-known/acme-challenge/wPCZZWAN8mlHLSQWr7ASZrJ_Tbk71g2Cd_1tPAv2JXM is asking for permission, probably affected by location ~ \.php$
So the question is: Can I integrate one solo function? like ~ / and \.php$ \.(?!well-known).* And if so, can I integrate the code of both all together?
location ~ /\.(?!well-known).* {
limit_req zone=admin burst=5 nodelay;
limit_req_status 503;
try_files $uri $uri/ /index.php?$query_string;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}