I am running nginx and would like to ask you help in explaining how to set up a correct configuration. Im not expert of server maintenance and would like to avoid to misconfigure the running sites.
Below an extract of nginx configuration (the part I think relevant) :
server {
server_name www.sub.example.com;
return 301 $scheme://sub.example.com$request_uri;
}
server {
listen 7000;
server_name example.com;
...
#listen 443 ssl; # managed by Certbot
#ssl_certificate /etc/letsencrypt/live/nifty.works/fullchain.pem; # managed by Certbot
#ssl_certificate_key /etc/letsencrypt/live/nifty.works/privkey.pem; # managed by Certbot
#include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
#ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
and a proxy server like:
# Virtualhost/server configuration
server {
listen 80;
server_name sub.example.com;
..
}
I am using certbot, and I remember I tried to set up automatically the certificate, but had an issue, an I succeded to install correctly an SSL certificate for the main site, if I recall well, using a wildcard certificate.
Certificate expired yesterday, I renewed it helping myself with:
certbot renewal
https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx
and can see it works OK with the main site.
However, with sub sites, https://sub.example.com
points will display the site of the main https://example.com
(note, it is not a redirect), while with http http://sub.example.com
displays the correct site.
With sudo certbot certonly --nginx
I can see the list of subdomains to activate https for.
Before tampering, I would like to ask you:
Can you can help to brief me out in setting up a correct configuration for SSL also for subdomains?
Please note that all subdomains makes use of APIs (mostly GET, a few POST) : I am concerned about breaking the site (backend is in flask python, and possibly wish to avoid to set up users credentials - it is just an open site, with a few share plugins from socials).