server { listen {{ http_port }}; server_name {{ item.servername }}; access_log on; # This is the default for nginx on Ubuntu 12.04 root /usr/share/nginx/www/; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } # don't send the nginx version number in error pages and Server header server_tokens off; # Proxy stuff proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_buffer_size {{ nginx_proxy_buffer_size }}; proxy_buffers {{ nginx_proxy_buffers }}; proxy_busy_buffers_size {{ nginx_proxy_busy_buffers_size }}; 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_http_version 1.1; proxy_redirect {{ nginx_proxy_redirect }}; proxy_buffering {{ nginx_proxy_buffering }}; proxy_connect_timeout {{ nginx_proxy_connect_timeout }}; proxy_read_timeout {{ nginx_proxy_read_timeout }}; proxy_send_timeout {{ nginx_proxy_send_timeout }}; {% for instance in tomcat_m_instances %} {% for context in instance.app_contexts %} location /{{ context }} { proxy_pass http://localhost:{{ item.http_port }}/{{ context }}; } {% endfor %} {% endfor %} {% if smart_executor_install %} location {{ smart_executor_context }} { proxy_pass http://localhost:{{ item.http_port }}{{ smart_executor_context }}; } {% endif %} }