Last active
April 20, 2021 09:31
-
-
Save thraizz/e58c1d71c689ab3ac58ba9609f7bb841 to your computer and use it in GitHub Desktop.
Minimal nginx.conf for reverse proxy usage
This file contains 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
events { | |
} | |
http { | |
error_log /etc/nginx/error_log.log debug; | |
client_max_body_size 20m; | |
proxy_cache_path /etc/nginx/cache keys_zone=one:500m max_size=1000m; | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
server_name _; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
server_name blog.lakur.tech; | |
index index.php; | |
try_files $uri $uri/ =404; | |
listen 443 ssl; | |
ssl_certificate /etc/letsencrypt/live/lakur.tech/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/lakur.tech/privkey.pem; | |
include /etc/letsencrypt/options-ssl-nginx.conf; | |
# Use docker DNS for proxy resolving | |
resolver 127.0.0.11; | |
include /etc/nginx/includes/proxy.conf; | |
# Replace this with your containers name | |
set $blog http://production-lakur_blog; | |
location / { | |
proxy_set_header X-Forwarded-Host $host; | |
proxy_set_header X-Forwarded-Server $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_pass $blog; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment