By ariziragoran
server {
listen 80;
listen [::]:80;
server_name www.domain.com *.domain.com;
return 301 http://domain.com;
}
server {
listen 80;
listen [::]:80;
root /var/www/domain.com/html;
index index.html index.htm index.nginx-debian.html;
server_name domain.com;
location / {
try_files $uri $uri/ =404;
}
}
The tutorial says to add to the SSL Server Block
location ~ /.well-known {
allow all;
}
so i updated mine to be:
server {
listen 80;
listen [::]:80;
server_name www.domain.com *.domain.com;
return 301 http://domain.com;
}
server {
listen 80;
listen [::]:80;
root /var/www/domain.com/html;
index index.html index.htm index.nginx-debian.html;
server_name domain.com;
location ~ /.well-known {
allow all;
}
location / {
try_files $uri $uri/ =404;
}
}
I was just wondering if this is the proper way to do it or if there is a better way to do it?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
If you’re using the web root option, that’s the method you’ll need to use.
The other option would be to use the certonly option, though you’d need to stop NGINX, run the certificate command, and then start NGINX since the Let’s Encrypt (now CertBot) application needs to access ports 80 and 443.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.