Can't find the acme challenge

I made the change, restarted apache, and still don't see a difference D:

<VirtualHost *:80>
        ServerName _
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =armor-computers.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
armorcom@localhost:~$ sudo service apache2 restart
armorcom@localhost:~$ apachectl -t -D DUMP_VHOSTS
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:443                  armor-computers.com (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2)
*:80                   _ (/etc/apache2/sites-enabled/000-default.conf:1)

The "difference" is here:
[BEFORE]

curl -Ii4 armor-computers.com
HTTP/1.1 200 OK
Date: Tue, 19 Jul 2022 17:40:14 GMT
Server: Apache/2.4.41 (Ubuntu)
Last-Modified: Tue, 19 Jul 2022 04:28:57 GMT
ETag: "94be-5e420ec3c4938"
Accept-Ranges: bytes
Content-Length: 38078
Vary: Accept-Encoding
Content-Type: text/html

[AFTER]

curl -Ii4 armor-computers.com
HTTP/1.1 301 Moved Permanently
Date: Tue, 19 Jul 2022 18:25:00 GMT
Server: Apache/2.4.41 (Ubuntu)
Location: https://armor-computers.com/
Content-Type: text/html; charset=iso-8859-1

So, we are in the right place!

4 Likes

Now let's see how we can get you a cert!

3 Likes

Replace that with:

<VirtualHost *:80>
  ServerName _
  ServerAdmin webmaster@localhost
  DocumentRoot /var/www/html   # THIS ALSO NEEDS TO BE CHANGED [TOO RISKY FOR ME]
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
  #skip challenge requests and
  <LocationMatch "^/(?!\.well-known)">
    #send all other requests to HTTPS
    RewriteEngine On
    RewriteCond %{SERVER_NAME} =armor-computers.com
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1
  </LocationMatch>
</VirtualHost>
3 Likes

I'm sorry about the late reply :\

Anyway, I've added your latest example to 000-default.conf

I didn't change the DocumentRoot directory because I feel since it's only serving static HTML it's pretty safe. Additionally, there's nothing on this machine other than the apache2 server, so all data loss across the entire machine would still be acceptable.

1 Like

Did you get a new cert?

4 Likes

I didn't attempt to generate one because you said "stop doing that" and I didn't realize I was supposed to try there, lol, my bad.

I ran it, it DID get the cert, but failed to install.

I am currently investigating the error, will update with solution if I find one

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/armor-computers.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/armor-computers.com/privkey.pem
This certificate expires on 2022-10-21.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for armor-computers.com to /etc/apache2/sites-enabled/000-default-le-ssl.conf
Failed redirect for armor-computers.com
Unable to set the redirect enhancement for armor-computers.com.

NEXT STEPS:
- The certificate was saved, but could not be installed (installer: apache). After fixing the error shown below, try installing it again by running:
  certbot install --cert-name armor-computers.com

Unable to find corresponding HTTP vhost; Unable to create one as intended addresses conflict; Current configuration does not support automated redirection
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

edit:
maybe this helps

$ sudo apachectl -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:443                  armor-computers.com (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2)
*:80                   _ (/etc/apache2/sites-enabled/000-default.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

BOOM! got it, just had to remove the underscore from ServerName and replace it with armor-computers.com

Seems great, thank you for all your help!

3 Likes

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