jdormit-infra/prod/nginx/packer/terraform/templates/nginx.conf.template

97 lines
2.7 KiB
Plaintext
Raw Normal View History

2021-10-04 21:30:46 +00:00
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
2021-10-04 21:30:46 +00:00
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
2021-10-04 17:29:59 +00:00
2021-10-04 21:30:46 +00:00
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
%{ for server in servers }
server {
server_name ${server.domain};
2021-10-04 17:29:59 +00:00
2021-10-04 21:30:46 +00:00
access_log /var/log/nginx/${server.domain}_access.log;
error_log /var/log/nginx/${server.domain}_error.log;
2021-10-04 17:29:59 +00:00
2021-10-04 21:30:46 +00:00
location / {
2021-10-05 21:45:53 +00:00
proxy_set_header Host $host;
2021-10-04 21:30:46 +00:00
proxy_pass http://${server.ip}:${server.port};
}
2021-10-04 17:29:59 +00:00
2021-10-04 21:30:46 +00:00
listen [::]:443 ssl;
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/jeremydormitzer.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/jeremydormitzer.com/privkey.pem;
ssl_session_cache shared:le_nginx_SSL:1m;
ssl_session_timeout 1440m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS";
2021-10-04 17:29:59 +00:00
2021-10-04 21:30:46 +00:00
}
%{ endfor ~}
server {
listen 80;
listen [::]:80;
return 301 https://$host$request_uri;
}
}
2021-10-04 21:30:46 +00:00
stream {
server {
listen 22;
proxy_pass ${gitea_ip}:22;
}
2021-10-04 17:29:59 +00:00
}