You are not logged in.
Ooops, looks like namecheap rejected those changes.
I just tried this, instead:
A Record *.realupnow.com 66.172.90.106 Automatic
Offline
You will need a certificate that includes both realupnow.com and www.realupnow.com so that's a new certificate; you don't want to keep the existing.
You still need to update your nginx configuration both so that it also services www.realupnow.com, and that it offers https access as well (to both domain names).
You may do the first by adding www.realupnow.com to the server_name directive (space separated).
The second, adding ssl, has a number of bits to it; perhaps the easiest is to search for that techrepublic howto ("setup ssl for nginx" might find it?) and pick knowledge from it.
Offline
Do I need to do this, first (adjusting to reflect nginx vs apache)?
certbot certificates
Find the path to the fullchain certificate you wish to reinstall
certbot revoke --cert-path /etc/letsencrypt/live/... path to the cert from above
certbot delete --cert-name yourdomain.com
rm -Rf /etc/apache2/sites-available/000-default-le-ssl.conf or whatever the name of the apache conf you had it configured on
rm -Rf 000-default-le-ssl.conf or whatever the name of the apache conf you had it configured on
sudo apache2ctl restart
certbot follow the guide to setup the new certificate
Offline
You still need to update your nginx configuration both so that it also services www.realupnow.com
You may do the first by adding www.realupnow.com to the server_name directive (space separated).
Do I recall, correctly, that requires altering the contents of these?
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
Offline
No. apparently certbot includes some bogus advice that might be useful for some apache2 setups but certainly not relevant for you. It's just that the certbot developers have had their "we must do it all" hats on and try to make the tool do much more than just preparing the certificate.
With "certonly --webroot" option you avoid that but obviously the program will still insist with bogus (though technically harmless) instructions.
Offline
To follow current sysadmin style, your nginx service configuration should be a main file /etc/nginx/sites-available/realupnow.conf and optionally a side file like /etc/nginx/snippets/ssl.conf, plus the link /etc/nginx/sites-enabled/realupnow.conf pointing to ../sites-available/realupnow.conf.
I don't see a direct need to change the main configuration in /etc/nginx/nginx.conf or /etc/nginx/nginx.conf.d/* but I might be wrong in that.
Offline
OK re. correct sysadmin style, thanks.
This is what I now have in /etc/nginx/sites-available/realupnow.com (which, maybe, needs to be renamed realupnow.conf?)
All the SSL Port 443 is commented out until I get the first part correct.
server {
listen 80;
root /var/www/realupnow.com;
index index.php index.html index.htm;
server_name realupnow.com www.realupnow.com;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
# server {
# listen 443 ssl realupnow.com;
# server_name realupnow.com www.realupnow.com;
# root /var/www/realupnow.com;
# index index.php index.html index.htm;
#
# location / {
# try_files $uri $uri/ =404;
# }
#
# location ~ \.php$ {
# include snippets/fastcgi-php.conf;
# fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# }
# }
Offline
You seem to still want the local names in the DNS setup to include the base domain name, and you have now defined resolution for www.realupnow.com.realupnow.com
The record should only have www and not www.realupnow.com
The local name will get realupnow.com appended automagically.
Offline
Type Host Value TTL
A Record @ 66.172.90.106 Automatic
A Record * 66.172.90.106 Automatic
A Record www 66.172.90.106 Automatic
Offline
Per your sysadmin style format - should I rename /etc/nginx/sites-available/realupnow.com to ~/realupnow.conf?
Offline
It doesn't matter too much; some editors provide indentation and "block" support for files ending in .conf which could be an argument for renaming, but the name is not important; only that the link has to point to the actual file.
The pathnames used in sites-enabled/ have the additional significance that nginx will process them in alphabetical order, and if many, the first ono is taken as "the default service" if it needs that. Since you have only one there is no potential of confusion.
In short: it's up to you but make sure the link is valid.
Offline
Renamed, link recreated to sites-enabled (old one removed),
ls -l /etc/nginx/sites-enabled
shows all good,
nginx -t
says all good, nginx restarted without error.
www.realupnow.com now works.
https://realupnow.com does not.
https://www.realupnow.com does not.
Last edited by dcolburn (2023-01-02 02:56:37)
Offline
Great. The ssl configuration can be merged with the plain http configration into a single "server {...}" block. That would bring the advantage of certainly sharing the "location {..}" blocks which are where you declare service the points.
But if you, as is customary nowawdays, primarily want to only provide https service, and hev the http service merely redirect to corresponding https service, then you would certainly have separate "server {..}" blocks.
Offline
Next, according to the manual the listen directive should look like:
listen 443 ssl;
and if you want it to include a "default_server" (which you don't ) then that should be mentioned before the ssl tag rather than after it.
Offline
server {
listen 80;
# listen [::]:80;
root /var/www/html;
server_name realupnow.com www.realupnow.com;
listen 443 ssl; # managed by Certbot
# RSA certificate
ssl_certificate /etc/letsencrypt/live/realupnow.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/realupnow.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
# Redirect non-https traffic to https
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
Offline
Should I relocate /var/www/realupnow.com to /var/www/html/realupnow.com so it's in keeping with all of the instructions online?
Or will that trigger a bunch of other necessary changes (more than just in /etc/nginx/sites-available/realupnow.com/conf)?
Offline
Yes, if it comforts you. I wouldn't .
And yes, you need to change the nginx configuration accordingly.
(I would rather keep in mind that I've choosen my own root and adapt instructions where needed)
Offline
Yes, if it comforts you. I wouldn't .
And yes, you need to change the nginx configuration accordingly.(I would rather keep in mind that I've choosen my own root and adapt instructions where needed)
OK, I'm good with that.
Does the code block I sent look OK, otherwise?
I commented out the IPv6 line.
I can change root /var/www/html; to root /var/www/;
Offline
Next, the server block needs to include a couple of ssl directives, in particular ssl_certificate and ssl_certificate_key
with the full pathnames for the ssl certificate and key.
Your certificate and chain have been saved at:
/etc/letsencrypt/live/realupnow.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/realupnow.com/privkey.pem
Note now that nginx run as user www-data, and that it needs access to those files. If your setup includes group ssl-cert for /etc/letsencrypt/live and /etc/letsencrypt/archive then the easy step is to add nginx to that group:
# adduser nginx ssl-cert
and then you are almost there...
Offline
/etc/letsencrypt/live and /etc/letsencrypt/archive are root:root do I want root:ssl-cert or ??
# adduser nginx ssl-cert
reports "The user 'nginx' does not exist."
Last edited by dcolburn (2023-01-02 03:39:32)
Offline
Ah, my mistake. The user is www-data... so perhaps the full sequence should be:
# addgroup ssl-cert
# chgrp ssl-cert /etc/letsencrypt/{live,archive}
# adduser www-data ssl-cert
And then you may verify access by getting no complaints from:
# runuser -u www-data cat /etc/letsencrypt/live/realupnow.com/fullchain.pem > /dev/null
Offline
Permission denied - do I need to preface with sudo?
Offline
Right. The "#" prompt is normally the signal for commands that needs to be run as root.
Offline
Right. The "#" prompt is normally the signal for commands that needs to be run as root.
Oddly, I'm logged in as root and I used sudo and it still "Permission denied"
Offline
If you are logged in as root then you won't need sudo.
Something else is wrong.
Can you copy&paste actually command and error?
Offline