brooklyn.entity.proxy.nginx.server.conf Maven / Gradle / Ivy
[#ftl]
# example nginx configuration file
pid ${driver.pidFile};
events {
worker_connections 8196;
}
http {
[#if entity.serverPoolAddresses?has_content]
upstream ${entity.id} {
[#list entity.serverPoolAddresses as address]
server ${address};
[/#list]
[#if entity.sticky]
sticky;
[/#if]
}
[/#if]
include mime.types;
default_type application/octet-stream;
server {
server_name ${entity.domain};
[#if entity.ssl]
# HTTPS setup
listen ${entity.port?c} default ssl;
ssl_certificate ${driver.runDir}/conf/global.crt;
ssl_certificate_key ${driver.runDir}/conf/global.key;
[#else]
# HTTP setup
listen ${entity.port?c};
[/#if]
# Logging
access_log ${driver.accessLogLocation};
error_log ${driver.errorLogLocation};
[#if entity.serverPoolAddresses?has_content]
location / {
proxy_pass http://${entity.id};
proxy_set_header X-Real-IP [#noparse]$remote_addr[/#noparse];
proxy_set_header X-Forwarded-For [#noparse]$proxy_add_x_forwarded_for[/#noparse];
proxy_set_header Host [#noparse]$http_host[/#noparse];
proxy_read_timeout 900;
proxy_connect_timeout 75;
}
[/#if]
}
}