Created
August 26, 2025 13:24
-
-
Save hzbd/0d5535d01c67d6e2d04fbac4133b0ec4 to your computer and use it in GitHub Desktop.
Nginx with ACME demo conf. https://sconts.com/post/nginx-native-acme-support/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /app/nginx/conf/nginx.conf | |
| user nginx; | |
| error_log error.log debug; | |
| pid nginx.pid; | |
| load_module modules/ngx_http_acme_module.so; | |
| events { | |
| worker_connections 1024; | |
| multi_accept on; | |
| } | |
| http { | |
| include mime.types; | |
| default_type application/octet-stream; | |
| log_format main '$remote_addr - $remote_user [$time_local] "$host" "$request" ' | |
| '$status $body_bytes_sent "$http_referer" ' | |
| '"$http_user_agent" "$http_x_forwarded_for"'; | |
| access_log access.log main; | |
| sendfile on; | |
| tcp_nopush on; | |
| charset utf-8; | |
| keepalive_timeout 65; | |
| gzip on; | |
| resolver 8.8.8.8 1.1.1.1; | |
| acme_issuer letsencrypt { | |
| uri https://acme-v02.api.letsencrypt.org/directory; | |
| contact mailto:[email protected]; | |
| state_path acme/letsencrypt; | |
| accept_terms_of_service; | |
| } | |
| acme_shared_zone zone=acme_shared:1M; | |
| server { | |
| listen 443 ssl; | |
| server_name ssl.aidig.co; | |
| acme_certificate letsencrypt; | |
| ssl_certificate $acme_certificate; | |
| ssl_certificate_key $acme_certificate_key; | |
| ssl_certificate_cache max=2; # required ngx 1.27.4+ | |
| location / { | |
| default_type text/plain; | |
| return 200 'OK'; | |
| } | |
| } | |
| server { | |
| listen 80 default_server; | |
| server_name _; | |
| location / { | |
| return 301 https://$host$request_uri; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment