Skip to content

Instantly share code, notes, and snippets.

@stfsy
Last active June 5, 2021 19:53
Show Gist options
  • Select an option

  • Save stfsy/7a1a8aa75a1a5eaeef01628486701794 to your computer and use it in GitHub Desktop.

Select an option

Save stfsy/7a1a8aa75a1a5eaeef01628486701794 to your computer and use it in GitHub Desktop.
NGINX configuration for lets encrypt files | certbot webroot command
include snippets/ssl.conf;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 4 4k;
server_tokens off;
server {
listen 8080;
server_name ${main_domain} ${additional_subdomain};
access_log off;
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root ${certbot_root_folder}/;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 8443 ssl http2;
server_name ${main_domain} ${additional_subdomain};
access_log off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
ssl_certificate /etc/letsencrypt/live/${main_domain}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${main_domain}/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/${main_domain}/chain.pem;
location / {
proxy_pass http://127.0.0.1:${https_target_port};
proxy_http_version 1.1;
proxy_set_header Connection "";
}
}
@stfsy
Copy link
Copy Markdown
Author

stfsy commented Jun 5, 2021

The included file ssl.conf can be found here https://gist.github.com/stfsy/4b12f37a57e5a19970fbaf939fcb707e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment