All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.brooklyn.entity.proxy.nginx.server.conf Maven / Gradle / Ivy

[#ftl]
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#
# 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 {
        [#if entity.domain?has_content]
        server_name                 ${entity.domain};
        [/#if]

        [#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;

        # https://wiki.mozilla.org/Security/Server_Side_TLS
        # https://mozilla.github.io/server-side-tls/ssl-config-generator/
        # generated 05.05.2015, Intermediate config from first link
        ssl_session_timeout         1d;
        ssl_session_cache           shared:SSL:50m;
        ssl_protocols               TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers                 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
        ssl_prefer_server_ciphers   on;
        [#else]
        # HTTP setup
        listen                      ${entity.port?c};
        [/#if]


        # Logging
        access_log                  ${driver.accessLogLocation};
        error_log                   ${driver.errorLogLocation};

        [#if entity.serverPoolAddresses?has_content]
        location / {
            server_tokens off;
            proxy_pass              http[#if entity.portNumberSensor.name == "https.port"]s[/#if]://${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]
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy