Nginx load balancer config templates
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
http { | |
upstream app-hosts { | |
{{ lb_method }}; | |
server {{ groups['appserver'][0] }}:8000; | |
} | |
access_log /var/log/nginx/access.log; | |
error_log /var/log/nginx/error.log; | |
# This server accepts all traffic to port 80 and passes it to the upstream. | |
# Notice that the upstream name and the proxy_pass need to match. | |
server { | |
listen 80; | |
server_name {{ domain_name }} www.{{ domain_name }}; | |
return 301 https://$server_name$request_uri; | |
#location / { | |
# proxy_pass http://app-hosts; | |
#} | |
} | |
server { | |
listen 443 ssl; | |
server_name {{ domain_name }} www.{{ domain_name }}; | |
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains"; | |
ssl_certificate /etc/letsencrypt/live/{{ domain_name }}/cert.pem; | |
ssl_certificate_key /etc/letsencrypt/live/{{ domain_name }}/privkey.pem; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
location / { | |
proxy_pass http://app-hosts; | |
} | |
} | |
} |
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
user www-data; | |
worker_processes auto; | |
pid /run/nginx.pid; | |
include /etc/nginx/modules-enabled/*.conf; | |
include /etc/nginx/sites-enabled/*; | |
events { | |
worker_connections 768; | |
# multi_accept on; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment