Website only opens with www, no support when www is omitted

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. https://crt.sh/?q=example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My working domain is: www.adaoma.shop

Not Working Domain is : adaoma.shop

I ran this command: I adhered to all procedures for letsencrypt installation from the letsencrypt installation guide.

My web server is (include version): Almighty Apache2 Server.

The operating system my web server runs on is (include version): Ubuntu 20

My hosting provider, if applicable, is: AWS

I can login to a root shell on my machine (yes or no, or I don't know): yes

I am running the AWS Ubuntu 20 server

1 Like

Did your domain without the www subdomain even work before you installed the certificate?

Also, which "letsencryypt installation guide" did you use? The internet is packed with so called "guides", one even worse than the other.

Also, why did you delete the question about the ACME client version?

9 Likes

I see your most recent cert only has the www domain in it. See history here

Also, HTTP requests to your apex adaoma.shop do not redirect to HTTPS like your www domain does.

As Osiris noted, it helps to know what ACME client you used and the version. There is not much more to say without that info.

9 Likes

Hi Osiris, I used the instructions under the link in quotes "Certbot Instructions | Certbot". Everything worked fine when I first installed, however, I changed my instance on AWS and reinstalled the cert on the new instance, then I got the option for www.adaoma.shop, but couldn't input for adaoma.shop and couldn't use wildcard on the cert request.

1 Like

You're right MileMcQ, those are the exact experiences am having right now, a redirect from http doesn't catch the full path to the current URL of the page, all redirect is to the home page. Is there a way I can make corrections on my vhost configurations, I need a clue on a possible fix.

1 Like

Hi @lordmalcolm !
Would you please share the output from these commands:

apache2ctl -t -D DUMP_VHOSTS
and
apache2ctl -S

Might help "close the gap" !

11 Likes

OK, that's good.

If you used the --apache plugin and Certbot did not present the option for your apex domain, most likely your Apache wasn't configured properly for it.

Please run the commands suggested by @Rip to check your webservers configuration further.

9 Likes

[Sun Sep 04 01:08:21.611637 2022] [so:warn] [pid 347640] AH01574: module rewrite_module is already loaded, skipping
VirtualHost configuration:
*:443 www.adaoma.shop (/etc/apache2/sites-enabled/adaoma.shop-le-ssl.conf:2)
*:80 is a NameVirtualHost
default server ip-172-31-21-87.us-west-1.compute.internal (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost ip-172-31-21-87.us-west-1.compute.internal (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost www.adaoma.shop (/etc/apache2/sites-enabled/adaoma.shop.conf:1)
wild alias *.adaoma.shop
port 80 namevhost www.adaoma.shop (/etc/apache2/sites-enabled/adaoma.shop.conf:18)
wild alias *.adaoma.shop

VirtualHost configuration:
*:443 www.adaoma.shop (/etc/apache2/sites-enabled/adaoma.shop-le-ssl.conf:2)
*:80 is a NameVirtualHost
default server ip-172-31-21-87.us-west-1.compute.internal (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost ip-172-31-21-87.us-west-1.compute.internal (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost www.adaoma.shop (/etc/apache2/sites-enabled/adaoma.shop.conf:1)
wild alias *.adaoma.shop
port 80 namevhost www.adaoma.shop (/etc/apache2/sites-enabled/adaoma.shop.conf:18)
wild alias *.adaoma.shop
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
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
Mutex default: dir="/var/run/apache2/" mechanism=default
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

Thanks @Rip & @Osiris for the prompt responses, awaiting your replies, this is a wonderful forum.

3 Likes

I may stand to be corrected here, but you might consider a couple changes that stand out to me.

I think your vhost:80 file should look something more like this:

<VirtualHost *:80>
    ServerName adaoma.shop
	ServerAlias www.adaoma.shop
....

Then run

certbot 

It should list BOTH the available domain/sub.domains for your certs...
FOLLOW THE PROMPTS and read carefully!
CertBot should rebuild your adaoma.shop-le-ssl.conf for you.

Hope this helps.

10 Likes

I actually have the ServerName with the www and Alias as a wildcard :slight_smile:

ServerName www.adaoma.shop
ServerAlias *.adaoma.shop

Do you mean I pen down the observed changes and rerun the installation of certbot?

Also, how about the issue of redirect not catching the complete redirect request issued for redirect? All redirect are to the home page if https is not included in the redirect.

In addition to what @Rip suggested, I see a name:port conflict:

Please show the file:
/etc/apache2/sites-enabled/adaoma.shop.conf

As for the topic title, there is only "www" being served via HTTPS:

11 Likes
  <VirtualHost *:80>
          ServerAdmin admin@adaoma.shop
          ServerName www.adaoma.shop
          ServerAlias *.adaoma.shop
          DocumentRoot /var/www/html/adaoma/
          <Directory /var/www/html/adaoma/>
                  Options Indexes FollowSymLinks
                  AllowOverride All
                  Require all granted
          </Directory>
          ErrorLog ${APACHE_LOG_DIR}/error.log
          CustomLog ${APACHE_LOG_DIR}/access.log combined
          RewriteEngine on
          RewriteCond %{SERVER_NAME} =www.adaoma.shop [OR]
          RewriteCond %{SERVER_NAME} =*.adaoma.shop
          RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URL} [END,NE,R=permanent]
  </VirtualHost>
  <VirtualHost *:80>
          ServerName www.adaoma.shop
          ServerAlias *.adaoma.shop
          ServerAdmin admin@adaoma.shop
          RedirectMatch permanent ^/(.*)$ http://www.adaoma.shop/$1
  </VirtualHost>
2 Likes

Pick one (and delete the other) - they both are essentially doing the same thing.
The second vhost looks better than the first.

11 Likes

You mean I should have only the below as my vhost and adhere to @Rip corrections?

<VirtualHost *:80>
          ServerName www.adaoma.shop
          ServerAlias *.adaoma.shop
          ServerAdmin admin@adaoma.shop
          RedirectMatch permanent ^/(.*)$ http://www.adaoma.shop/$1
  </VirtualHost>

How do I resolve the redirect issue I mentioned.

1 Like

I would use the directory block in whichever is kept.

9 Likes

Yes, change "*" to "www".
[unless you actually get a wildcard cert and intend on using it there]

EDIT:

that should be:

          ServerName www.adaoma.shop
          ServerAlias adaoma.shop

OR

          ServerName adaoma.shop
          ServerAlias www.adaoma.shop
11 Likes

Made the necessary changes and ran certbot, below is the output :slight_smile:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Certbot doesn't know how to automatically configure the web server on this system. However, it can still get a certificate for you. Please run "certbot certonly" to do so. You'll need to manually configure your web server to use the resulting certificate.

Show more of the command ran and output.

And show this output again:

11 Likes