Hey there. I set up a server to teach myself Linux, so it has a hodgepodge of services spackled together, all behind all nginx reverse proxy. I have since become more proficient in administration, but this server is out of state, and not something I want to tear down and rebuild. Thus, I am stuck trying to solve this problem:
Situation:
I have an nginx reverse proxy running on CentOS that receives all traffic from 80 and 443. Traffic is not redirected to 443 on the reverse proxy. I have two specific services that I am focused on.
The command I am using to obtain the certs is:
certbot certonly --webroot -w /var/www/$FQDN -d $FQDN
Please find the relevant Nginx config files below. These are located on the reverse proxy itself.
Subdomain 1 - this one works:
# /etc/nginx/conf.d/sub1.domain.org.conf
server {
listen 80;
server_name sub1.domain.org;
include conf.d/acme.inc;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://192.168.1.46;
client_max_body_size 5G;
}
}
and
# /etc/nginx/conf.d/acme.inc
location ^~ /.well-known/acme-challenge {
allow all;
alias /var/www/acme;
}
Subdomain 2 - this one doesn't work:
However, when I do what, to my eyes is the same thing for my other service:
# /etc/nginx/conf.d/sub2.domain.org
server {
listen 80;
server_name sub2.domain.org;
include conf.d/acme.inc;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://192.168.1.30;
client_max_body_size 100M;
}
}
... with the included acme.inc file as posted above.
The error message is as follows:
FailedChallenges: Failed authorization procedure. $FQDN (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://$FQDN/.well-known/acme-challenge/YGdiTdw6WXr4fKGoUgqQQth0RvafnKatcFo52jmejL0: "\r\n404 Not Found\r\n<body bgcolor="white">\r\n<h1>404 Not Found\r\n
I am not sure what the issue is. I have also compared the apache configs on the backends, and they are fairly similar, though they really should not matter since the reverse proxy is where Let'sEncrypt is looking.
Any help is appreciated. I am happy to provide other configuration files when requested. I have some time before I can try again, since I am rate-limited after several failed attempts... for the second day in a row. ![]()
Thanks!
