Skip to content

Instantly share code, notes, and snippets.

@abel0b
Created January 16, 2020 17:22
Show Gist options
  • Select an option

  • Save abel0b/0ba1b07a225707b45abc8b50e9f66c6f to your computer and use it in GitHub Desktop.

Select an option

Save abel0b/0ba1b07a225707b45abc8b50e9f66c6f to your computer and use it in GitHub Desktop.
nginx + TLS + docker
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '[$time_local] $host $remote_addr - $remote_user "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
resolver 127.0.0.11 valid=30s;
server {
listen 80;
listen [::]:80;
server_name example.org;
location ^~ /.well-known/acme-challenge/ {
alias /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
listen [::]:443;
ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
server_name example.org;
location / {
set $upstream foobar;
proxy_pass http://$upstream;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment