Skip to content

Instantly share code, notes, and snippets.

@goodtiding5
Created January 24, 2019 01:06
Show Gist options
  • Save goodtiding5/5574a97104154ce9cebaa4ca87b0d6f6 to your computer and use it in GitHub Desktop.
Save goodtiding5/5574a97104154ce9cebaa4ca87b0d6f6 to your computer and use it in GitHub Desktop.
Basic Nginx Host conf
server {
listen 80;
listen [::]:80;
server_name www.example.com example.com;
root /var/www/example.com;
index index.html;
location ^~ /.well-known/acme-challenge/ {
# Set correct content type. According to this:
# https://community.letsencrypt.org/t/using-the-webroot-domain-verification-method/1445/29
# Current specification requires "text/plain" or no content header at all.
# It seems that "text/plain" is a safe option.
default_type "text/plain";
# This directory must be the same as in /etc/letsencrypt/cli.ini
# as "webroot-path" parameter. Also don't forget to set "authenticator" parameter
# there to "webroot".
# Do NOT use alias, use root! Target directory is located here:
# /var/www/common/letsencrypt/.well-known/acme-challenge/
root /var/www/letsencrypt;
}
location / {
try_files $uri $uri/ =404;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment