Unable to get certificate for subdomain

Yea, both show the same IP

s0ap@ampache:~$ curl -4 ifconfig.co
185.222.21.139
s0ap@ampache:~$ nslookup ampache.sopel.dev
Server:         127.0.0.53
Address:        127.0.0.53#53

Non-authoritative answer:
ampache.sopel.dev       canonical name = sopel.dev.
Name:   sopel.dev
Address: 185.222.21.139

s0ap@ampache:~$ 

Ok, I am going to quickly spin a new VM with a new CNAME and see if I can get that to SSL.

Right, So I have spun up another VM, different name, IP ect, got apache working and I went to the CNAME I set which is music.sopel.dev, I go to the padlock, inspect the certificate (I have NOT run certbot yet) and it says common name is nextcloud.sopel.dev, why?

can you show me the output of

sudo ss -tlpn

?

1 Like

I nuked the other server, I am getting error now though. Please see below:

s0ap@music:~$ sudo certbot
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: music.sopel.dev
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Requesting a certificate for music.sopel.dev
Performing the following challenges:
http-01 challenge for music.sopel.dev
Enabled Apache rewrite module
Waiting for verification...
Challenge failed for domain music.sopel.dev
http-01 challenge for music.sopel.dev
Cleaning up challenges
Some challenges have failed.

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: music.sopel.dev
   Type:   connection
   Detail: 185.222.21.139: Fetching
   http://music.sopel.dev/.well-known/acme-challenge/Kc3qntfbdPzMwN4gb757n22y48iPrnvdjZMMQIy0qUY:
   Error getting validation data

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address. Additionally, please check that
   your computer has a publicly routable IP address and that no
   firewalls are preventing the server from communicating with the
   client. If you're using the webroot plugin, you should also verify
   that you are serving files from the webroot path you provided.

And your output is:

s0ap@music:~$ sudo ss -tlpn
State     Recv-Q     Send-Q         Local Address:Port         Peer Address:Port    Process                                       
LISTEN    0          4096           127.0.0.53%lo:53                0.0.0.0:*        users:(("systemd-resolve",pid=966,fd=14))    
LISTEN    0          128                  0.0.0.0:22                0.0.0.0:*        users:(("sshd",pid=1611,fd=3))               
LISTEN    0          128                     [::]:22                   [::]:*        users:(("sshd",pid=1611,fd=4))               
LISTEN    0          511                        *:80                      *:*        users:(("apache2",pid=4416,fd=4),("apache2",pid=4415,fd=4),("apache2",pid=3039,fd=4))

Sorry to confuse this situation.

In your apache config I did not see anything referring to nextcloud, though.

Where does it come from?

1 Like

Like I said in my initial post, I made a mistake and I added nextcloud.sopel.dev and sopel.dev as A records, pointing to the same IP address. When I can certbot for my nextcloud server it worked just fine, everything after that stopped working (apart from nextcloud) once I removed nextcloud.sopel.dev as an A record and made it a CNAME record. Are certbot servers still using the old A record that I deleted?

How many servers are you currently using?

Please tell me what is this server doing, and how you installed nextcloud. Because it looks like nextcloud is taking over your entire server.

1 Like

I am using ESXi, each server is a separate VM. Each VM has only one service running. That's what I am suspecting, every instance I run from any server somehow references nextcloud.sopel.dev even though it's already gone. I think I nuked my own domain :expressionless:

Ok, you need a reverse proxy to send each VM the requests for its own services and its own services only. or a public IP address for each service.

The easy way to get a reverse proxy working is to use Caddy.

3 Likes

Hi, just to let you know, I followed your advice but instead of caddy I set up a dedicated nginx server as a reverse proxy and for SSL. Everything is working now. Thank you a lot.

3 Likes

Yeah, nginx is fine too. Caddy has a lot of "quality of life" advantages.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.