<?php

/**
 * resources/templates/etc/appserver/appserver.xml.phtml
 *
 * PHP version 5
 *
 * @category   Server
 * @package    Appserver
 * @subpackage Meta
 * @author     Tim Wagner <tw@appserver.io>
 * @author     Bernhard Wick <bw@appserver.io>
 * @author     Johann Zelger <jz@appserver.io>
 * @copyright  2014 TechDivision GmbH <info@appserver.io>
 * @license    http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 * @link       http://www.appserver.io
 */

use AppserverIo\Appserver\Meta\Composer\Script\Setup;
use AppserverIo\Appserver\Meta\Composer\Script\SetupKeys;

?>
<?php echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
<appserver xmlns="http://www.appserver.io/appserver"  xmlns:xi="http://www.w3.org/2001/XInclude">

    <params>
        <param name="user" type="string"><?php echo Setup::getValue(SetupKeys::USER) ?></param>
        <param name="group" type="string"><?php echo Setup::getValue(SetupKeys::GROUP) ?></param>
        <param name="umask" type="string"><?php echo Setup::getValue(SetupKeys::UMASK) ?></param>
        <param name="allowApplicationConfiguration" type="boolean">true</param>
    </params>

    <!--
     ! This is the management console that allows you to start/stop the application server and
     | switch the setup mode. Do never bind it to a public IP, because Telnet is NOT secure!!!
     -->
    <consoles>

        <console
            name="telnet"
            type="AppserverIo\Appserver\Core\Consoles\Telnet"
            factory="AppserverIo\Appserver\Core\Consoles\TelnetFactory">

            <params>
                <param name="address" type="string">127.0.0.1</param>
                <param name="port" type="integer">9023</param>
            </params>
        </console>
    </consoles>

    <!--
     ! Customize this to fit your needs ragarding log information. The logLevel attribute can be one
     ! of https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#5-psrlogloglevel.
     -->

    <loggers>
        <logger channelName="system" name="System" type="\AppserverIo\Logger\Logger">
            <handlers>
                <handler type="\AppserverIo\Logger\Handlers\CustomFileHandler">
                    <formatter type="\AppserverIo\Logger\Formatters\StandardFormatter"/>
                    <params>
                        <param name="logFile" type="string">var/log/appserver-errors.log</param>
                        <param name="logLevel" type="string">info</param>
                    </params>
                </handler>
            </handlers>
        </logger>
        <logger channelName="access" name="Access" type="\AppserverIo\Logger\Logger">
            <handlers>
                <handler type="\AppserverIo\Logger\Handlers\CustomFileHandler">
                    <formatter type="\AppserverIo\Logger\Formatters\StandardFormatter">
                        <params>
                            <param name="format" type="string">%4$s</param>
                        </params>
                    </formatter>
                    <params>
                        <param name="logFile" type="string">var/log/appserver-access.log</param>
                        <param name="logLevel" type="string">info</param>
                    </params>
                </handler>
            </handlers>
        </logger>
    </loggers>

    <!--
     ! Customize to add/remove scanners as needed
     ! http://appserver.io/get-started/documentation/1.0/configuration.html#scanner
     -->
     <scanners>
         <scanner
             name="deployment-system-container"
             type="AppserverIo\Appserver\Core\Scanner\DeploymentScanner"
             factory="AppserverIo\Appserver\Core\Scanner\DirectoryScannerFactory">
             <params>
                 <param name="interval" type="integer">1</param>
                 <param name="extensionsToWatch" type="string">dodeploy, deployed</param>
             </params>
             <directories>
                 <directory>var/deploy</directory>
             </directories>
         </scanner>
         <scanner
             name="deployment-combined-appserver"
             type="AppserverIo\Appserver\Core\Scanner\DeploymentScanner"
             factory="AppserverIo\Appserver\Core\Scanner\DirectoryScannerFactory">
             <params>
                 <param name="interval" type="integer">1</param>
                 <param name="extensionsToWatch" type="string">dodeploy, deployed</param>
             </params>
             <directories>
                 <directory>deploy</directory>
             </directories>
         </scanner>
         <scanner
             name="cron"
             type="AppserverIo\Appserver\Core\Scanner\CronScanner"
             factory="AppserverIo\Appserver\Core\Scanner\StandardScannerFactory">
             <params>
                 <param name="interval" type="integer">1</param>
             </params>
             <directories>
                 <directory>var/log</directory>
             </directories>
         </scanner>
         <scanner
             name="logrotate"
             type="AppserverIo\Appserver\Core\Scanner\LogrotateScanner"
             factory="AppserverIo\Appserver\Core\Scanner\DirectoryScannerFactory">
             <params>
                 <param name="interval" type="integer">1</param>
                 <param name="extensionsToWatch" type="string">log</param>
                 <param name="maxFiles" type="integer">10</param>
                 <param name="maxSize" type="integer">1048576</param>
             </params>
             <directories>
                 <directory>var/log</directory>
             </directories>
         </scanner>
    </scanners>

    <!--
     ! You might add optional configuration for implicitly configured components here.
     !
     ! http://appserver.io/get-started/documentation/configuration.html#optional-configuration
     -->

    <containers>

        <container
                name="system-container"
                type="AppserverIo\Appserver\Core\GenericContainer"
                factory="AppserverIo\Appserver\Core\GenericContainerFactory">

            <description>
                <![CDATA[Container for appserver.io internal functionality]]>
            </description>

            <deployment type="AppserverIo\Appserver\Core\GenericDeployment" />

            <host name="internal" appBase="internal" deployBase="var/deploy" tmpBase="var/tmp/internal" />

            <servers>

                <server
                    name="dns"
                    type="\AppserverIo\Server\Servers\MultiThreadedServer"
                    worker="\AppserverIo\DnsServer\Workers\UdpThreadWorker"
                    socket="\AppserverIo\Server\Sockets\StreamSocket"
                    streamContext="\AppserverIo\Server\Contexts\StreamContext"
                    serverContext="\AppserverIo\Server\Contexts\ServerContext"
                    requestContext="\AppserverIo\Server\Contexts\RequestContext"
                    loggerName="System">

                    <params>
                        <param name="admin" type="string"><?php echo Setup::getValue(SetupKeys::ADMIN_EMAIL) ?></param>
                        <param name="transport" type="string">udp</param>
                        <param name="address" type="string">127.0.0.1</param>
                        <param name="port" type="integer">9053</param>
                        <param name="flags" type="string">STREAM_SERVER_BIND</param>
                        <param name="workerNumber" type="integer">4</param>
                        <param name="workerAcceptMin" type="integer">3</param>
                        <param name="workerAcceptMax" type="integer">8</param>
                    </params>

                    <connectionHandlers>
                        <connectionHandler type="\AppserverIo\DnsServer\ConnectionHandlers\DnsConnectionHandler" />
                    </connectionHandlers>

                    <modules>
                        <module type="\AppserverIo\DnsServer\Modules\CoreModule" >
                            <params>
                                <param name="resolverFactory" type="string">\AppserverIo\Appserver\Core\Modules\StorageProvider\SystemConfigurationResolverFactory</param>
                                <param name="defaultTTL" type="integer">300</param>
                            </params>
                        </module>
                    </modules>

                </server>

                <server
                        name="api"
                        type="\AppserverIo\Server\Servers\MultiThreadedServer"
                        worker="\AppserverIo\Server\Workers\ThreadWorker"
                        socket="\AppserverIo\Server\Sockets\StreamSocket"
                        requestContext="\AppserverIo\Server\Contexts\RequestContext"
                        serverContext="\AppserverIo\Appserver\Server\Contexts\StandardServerContext"
                        streamContext="\AppserverIo\Server\Contexts\StreamContext"
                        loggerName="System">

                    <params>
                        <param name="admin" type="string"><?php echo Setup::getValue(SetupKeys::ADMIN_EMAIL) ?></param>
                        <param name="transport" type="string">tcp</param>
                        <param name="address" type="string">127.0.0.1</param>
                        <param name="port" type="integer">9024</param>
                        <param name="workerNumber" type="integer">4</param>
                        <param name="workerAcceptMin" type="integer">3</param>
                        <param name="workerAcceptMax" type="integer">8</param>
                        <param name="documentRoot" type="string">internal</param>
                        <param name="directoryIndex" type="string">index.do index.html</param>
                        <param name="keepAliveMax" type="integer">64</param>
                        <param name="keepAliveTimeout" type="integer">5</param>
                        <param name="errorsPageTemplatePath" type="string">resources/templates/www/error.phtml</param>
                    </params>

                    <environmentVariables>
                        <environmentVariable condition="" definition="LOGGER_ACCESS=Access" />
                    </environmentVariables>

                    <connectionHandlers>
                        <connectionHandler type="\AppserverIo\WebServer\ConnectionHandlers\HttpConnectionHandler" />
                    </connectionHandlers>

                    <accesses>
                        <!-- per default allow everything -->
                        <access type="allow">
                            <params>
                                <param name="X_REQUEST_URI" type="string">.*</param>
                            </params>
                        </access>
                    </accesses>

                    <modules>
                        <!-- REQUEST_POST hook -->
                        <module type="\AppserverIo\WebServer\Modules\VirtualHostModule"/>
                        <module type="\AppserverIo\WebServer\Modules\AuthenticationModule"/>
                        <module type="\AppserverIo\WebServer\Modules\EnvironmentVariableModule" />
                        <module type="\AppserverIo\WebServer\Modules\RewriteModule"/>
                        <module type="\AppserverIo\WebServer\Modules\DirectoryModule"/>
                        <module type="\AppserverIo\WebServer\Modules\AccessModule"/>
                        <module type="\AppserverIo\WebServer\Modules\LocationModule"/>
                        <!-- FileHandler Modules -->
                        <module type="\AppserverIo\WebServer\Modules\CoreModule"/>
                        <module type="\AppserverIo\Appserver\ServletEngine\ServletEngine"/>
                        <module type="\AppserverIo\WebServer\Modules\ProxyModule"/>
                        <!-- RESPONSE_PRE hook -->
                        <module type="\AppserverIo\WebServer\Modules\HeaderModule"/>
                        <module type="\AppserverIo\WebServer\Modules\DeflateModule"/>
                        <!-- RESPONSE_POST hook -->
                        <!-- module type="\AppserverIo\Appserver\Core\Modules\ProfileModule"/ -->
                    </modules>

                    <fileHandlers>
                        <fileHandler name="servlet" extension=".dhtml" />
                        <fileHandler name="servlet" extension=".do" />
                    </fileHandlers>

                </server>

            </servers>

        </container>

        <container
                name="combined-appserver"
                type="AppserverIo\Appserver\Core\GenericContainer"
                factory="AppserverIo\Appserver\Core\GenericContainerFactory">

            <description>
                <![CDATA[This is an example of a webserver container that handles http requests in common way]]>
            </description>

            <deployment type="AppserverIo\Appserver\Core\GenericDeployment" />

            <host name="localhost" appBase="webapps" deployBase="deploy" tmpBase="var/tmp/localhost" />

            <!--
             ! This is an example of how to configure upstream backends for proxy usage.
             -->
            <!--
            <upstreams>
                <upstream name="exampleBackend" type="\AppserverIo\WebServer\Upstreams\DefaultUpstream">
                    <servers xmlns="">
                        <server name="local-apache" type="\AppserverIo\WebServer\Upstreams\Servers\DefaultServer">
                            <params xmlns="http://www.appserver.io/appserver">
                                <param name="address" type="string">127.0.0.1</param>
                                <param name="port" type="integer">80</param>
                                <param name="weight" type="integer">1</param>
                                <param name="maxFails" type="integer">10</param>
                                <param name="failTimeout" type="integer">30</param>
                                <param name="maxConns" type="integer">64</param>
                                <param name="backup" type="boolean">false</param>
                                <param name="down" type="boolean">false</param>
                                <param name="resolve" type="boolean">false</param>
                            </params>
                        </server>
                        <server name="local-nginx" type="\AppserverIo\WebServer\Upstreams\Servers\DefaultServer">
                            <params xmlns="http://www.appserver.io/appserver">
                                <param name="address" type="string">127.0.0.1</param>
                                <param name="port" type="integer">8080</param>
                                <param name="weight" type="integer">1</param>
                                <param name="maxFails" type="integer">10</param>
                                <param name="failTimeout" type="integer">30</param>
                                <param name="maxConns" type="integer">64</param>
                                <param name="backup" type="boolean">false</param>
                                <param name="down" type="boolean">false</param>
                                <param name="resolve" type="boolean">false</param>
                            </params>
                        </server>
                    </servers>
                </upstream>
            </upstreams>
             -->

            <servers>

                <!--
                 | To distribute componenents like SLSBs across a network, you've to configure separate server for
                 | the Persistence-Container.
                 |
                 | http://appserver.io/get-started/documentation/configuration.html#persistence-container-(remote)
                 |-->

                <server
                        name="message-queue"
                        type="\AppserverIo\Server\Servers\MultiThreadedServer"
                        worker="\AppserverIo\Server\Workers\ThreadWorker"
                        socket="\AppserverIo\Server\Sockets\StreamSocket"
                        requestContext="\AppserverIo\Server\Contexts\RequestContext"
                        serverContext="\AppserverIo\Appserver\Server\Contexts\StandardServerContext"
                        streamContext="\AppserverIo\Server\Contexts\StreamContext"
                        loggerName="System">

                    <params>
                        <param name="admin" type="string"><?php echo Setup::getValue(SetupKeys::ADMIN_EMAIL) ?></param>
                        <param name="transport" type="string">tcp</param>
                        <param name="address" type="string"><?php echo Setup::getValue(SetupKeys::CONTAINER_MESSAGE_QUEUE_HOST) ?></param>
                        <param name="port" type="integer"><?php echo Setup::getValue(SetupKeys::CONTAINER_MESSAGE_QUEUE_PORT) ?></param>
                        <param name="workerNumber" type="integer"><?php echo Setup::getValue(SetupKeys::CONTAINER_MESSAGE_QUEUE_WORKER_NUMBER) ?></param>
                        <param name="workerAcceptMin" type="integer"><?php echo Setup::getValue(SetupKeys::CONTAINER_SERVER_WORKER_ACCEPT_MIN) ?></param>
                        <param name="workerAcceptMax" type="integer"><?php echo Setup::getValue(SetupKeys::CONTAINER_SERVER_WORKER_ACCEPT_MAX) ?></param>
                        <param name="documentRoot" type="string">webapps</param>
                        <param name="directoryIndex" type="string">index.mq</param>
                        <param name="keepAliveMax" type="integer">64</param>
                        <param name="keepAliveTimeout" type="integer">5</param>
                        <param name="errorsPageTemplatePath" type="string">resources/templates/www/error.phtml</param>
                    </params>

                    <environmentVariables>
                        <environmentVariable condition="" definition="LOGGER_ACCESS=Access" />
                    </environmentVariables>

                    <connectionHandlers>
                        <connectionHandler type="\AppserverIo\WebServer\ConnectionHandlers\HttpConnectionHandler" />
                    </connectionHandlers>

                    <accesses>
                        <!-- per default allow everything -->
                        <access type="allow">
                            <params>
                                <param name="X_REQUEST_URI" type="string">.*</param>
                            </params>
                        </access>
                    </accesses>

                    <modules>
                        <!-- REQUEST_POST hook -->
                        <module type="\AppserverIo\WebServer\Modules\AuthenticationModule"/>
                        <module type="\AppserverIo\WebServer\Modules\VirtualHostModule"/>
                        <module type="\AppserverIo\WebServer\Modules\EnvironmentVariableModule" />
                        <module type="\AppserverIo\WebServer\Modules\RewriteModule"/>
                        <module type="\AppserverIo\WebServer\Modules\DirectoryModule"/>
                        <module type="\AppserverIo\WebServer\Modules\AccessModule"/>
                        <module type="\AppserverIo\WebServer\Modules\CoreModule"/>
                        <module type="\AppserverIo\Appserver\MessageQueue\MessageQueueModule" />
                        <!-- RESPONSE_PRE hook -->
                        <module type="\AppserverIo\WebServer\Modules\DeflateModule"/>
                        <!-- RESPONSE_POST hook -->
                        <!-- module type="\AppserverIo\Appserver\Core\Modules\ProfileModule"/ -->
                    </modules>

                    <fileHandlers>
                        <fileHandler name="message-queue" extension=".mq" />
                    </fileHandlers>

                </server>

                <server
                        name="http"
                        type="\AppserverIo\Server\Servers\MultiThreadedServer"
                        worker="\AppserverIo\Server\Workers\ThreadWorker"
                        socket="\AppserverIo\Server\Sockets\StreamSocket"
                        requestContext="\AppserverIo\Server\Contexts\RequestContext"
                        serverContext="\AppserverIo\Appserver\Server\Contexts\StandardServerContext"
                        streamContext="\AppserverIo\Server\Contexts\StreamContext"
                        loggerName="System">
                    <params>
                        <param name="admin" type="string"><?php echo Setup::getValue(SetupKeys::ADMIN_EMAIL) ?></param>
                        <param name="transport" type="string">tcp</param>
                        <param name="address" type="string"><?php echo Setup::getValue(SetupKeys::CONTAINER_HTTP_HOST) ?></param>
                        <param name="port" type="integer"><?php echo Setup::getValue(SetupKeys::CONTAINER_HTTP_PORT) ?></param>
                        <param name="workerNumber" type="integer"><?php echo Setup::getValue(SetupKeys::CONTAINER_HTTP_WORKER_NUMBER) ?></param>
                        <param name="workerAcceptMin" type="integer"><?php echo Setup::getValue(SetupKeys::CONTAINER_SERVER_WORKER_ACCEPT_MIN) ?></param>
                        <param name="workerAcceptMax" type="integer"><?php echo Setup::getValue(SetupKeys::CONTAINER_SERVER_WORKER_ACCEPT_MAX) ?></param>
                        <param name="documentRoot" type="string">webapps</param>
                        <param name="directoryIndex" type="string">index.dhtml index.do index.php index.html index.htm</param>
                        <param name="keepAliveMax" type="integer">64</param>
                        <param name="keepAliveTimeout" type="integer">5</param>
                        <param name="autoIndex" type="boolean">false</param>
                        <param name="errorsPageTemplatePath" type="string">resources/templates/www/error.phtml</param>
                        <param name="welcomePageTemplatePath" type="string">resources/templates/www/welcome.phtml</param>
                        <param name="autoIndexTemplatePath" type="string">resources/templates/www/auto_index.phtml</param>
                    </params>

                    <!-- An example how to modify response headers -->
                    <!--
                    <headers>
                        <header type="response" name="Server" value="My Own Server" override="true"/>
                        <header type="response" name="X-Powered-By" value="appserver"/>
                    </headers>
                    -->

                    <!-- An example to activate a the auto index functionality on a custom directory -->
                    <!--
                    <locations>
                        <location condition="^\/example\/META-INF\/.*">
                            <headers>
                                <header type="response" name="X-Powered-By" value="autoIndex" append="true"/>
                            </headers>
                            <params>
                                <param name="autoIndex" type="boolean">true</param>
                            </params>
                        </location>
                    </locations>
                    -->

                    <!-- An example how to activate the proxy module to use an upstream backend -->
                    <!--
                    <locations>
                        <location condition="\/test\/.*">
                            <fileHandlers>
                                <fileHandler name="proxy" extension=".*">
                                    <params>
                                        <param name="transport" type="string">tcp</param>
                                        <param name="upstream" type="string">exampleBackend</param>
                                    </params>
                                </fileHandler>
                            </fileHandlers>
                        </location>
                    </locations>
                    -->

                    <environmentVariables>
                        <environmentVariable condition="" definition="LOGGER_ACCESS=Access" />
                    </environmentVariables>

                    <connectionHandlers>
                        <connectionHandler type="\AppserverIo\WebServer\ConnectionHandlers\HttpConnectionHandler" />
                    </connectionHandlers>

                    <!-- An example for basic or digest auth for the server -->
                    <!--
                    <authentications>
                        <authentication uri="^\/auth\/basic\/.*">
                            <params>
                                <param name="type" type="string">\AppserverIo\Http\Authentication\BasicAuthentication</param>
                                <param name="realm" type="string">PhpWebServer Basic Authentication System</param>
                                <param name="file" type="string">var/www/auth/basic/.htpasswd</param>
                            </params>
                        </authentication>
                        <authentication uri="^\/auth\/digest\/.*">
                            <params>
                                <param name="type" type="string">\AppserverIo\Http\Authentication\DigestAuthentication</param>
                                <param name="realm" type="string">appserver.io Digest Authentication System</param>
                                <param name="adapter-type" type="string">htdigest</param>
                                <param name="file" type="string">var/www/auth/digest/.htpasswd</param>
                            </params>
                        </authentication>
                    </authentications>
                    -->

                    <accesses>
                        <!-- per default allow everything -->
                        <access type="allow">
                            <params>
                                <param name="X_REQUEST_URI" type="string">.*</param>
                            </params>
                        </access>
                    </accesses>

                    <!-- include of virtual host configurations -->
                    <xi:include href="conf.d/virtual-hosts.xml"/>

                    <modules>
                        <!-- REQUEST_POST hook -->
                        <module type="\AppserverIo\WebServer\Modules\VirtualHostModule"/>
                        <module type="\AppserverIo\WebServer\Modules\AuthenticationModule"/>
                        <module type="\AppserverIo\WebServer\Modules\EnvironmentVariableModule" />
                        <module type="\AppserverIo\WebServer\Modules\RewriteModule"/>
                        <module type="\AppserverIo\WebServer\Modules\DirectoryModule"/>
                        <module type="\AppserverIo\WebServer\Modules\AccessModule"/>
                        <module type="\AppserverIo\WebServer\Modules\LocationModule"/>
                        <module type="\AppserverIo\WebServer\Modules\AutoIndexModule"/>
                        <!-- FileHandler Modules -->
                        <module type="\AppserverIo\WebServer\Modules\CoreModule"/>
                        <module type="\AppserverIo\WebServer\Modules\FcgiModule"/>
                        <module type="\AppserverIo\Appserver\ServletEngine\ServletEngine"/>
                        <module type="\AppserverIo\WebServer\Modules\ProxyModule"/>
                        <!-- RESPONSE_PRE hook -->
                        <module type="\AppserverIo\WebServer\Modules\HeaderModule"/>
                        <module type="\AppserverIo\WebServer\Modules\DeflateModule"/>
                        <!-- RESPONSE_POST hook -->
                        <!-- module type="\AppserverIo\Appserver\Core\Modules\ProfileModule"/ -->
                    </modules>

                    <fileHandlers>
                        <fileHandler name="fastcgi" extension=".php">
                            <params>
                                <param name="host" type="string"><?php echo Setup::getValue(SetupKeys::PHP_FPM_HOST) ?></param>
                                <param name="port" type="integer"><?php echo Setup::getValue(SetupKeys::PHP_FPM_PORT) ?></param>
                            </params>
                        </fileHandler>
                        <fileHandler name="fastcgi" extension=".phtml">
                            <params>
                                <param name="host" type="string"><?php echo Setup::getValue(SetupKeys::PHP_FPM_HOST) ?></param>
                                <param name="port" type="integer"><?php echo Setup::getValue(SetupKeys::PHP_FPM_PORT) ?></param>
                            </params>
                        </fileHandler>
                        <fileHandler name="servlet" extension=".dhtml" />
                        <fileHandler name="servlet" extension=".do" />
                    </fileHandlers>

                </server>

                <server
                        name="https"
                        type="\AppserverIo\Server\Servers\MultiThreadedServer"
                        worker="\AppserverIo\Server\Workers\ThreadWorker"
                        socket="\AppserverIo\Server\Sockets\StreamSocket"
                        requestContext="\AppserverIo\Server\Contexts\RequestContext"
                        serverContext="\AppserverIo\Appserver\Server\Contexts\StandardServerContext"
                        streamContext="\AppserverIo\Server\Contexts\StreamContext"
                        loggerName="System">
                    <params>
                        <param name="admin" type="string"><?php echo Setup::getValue(SetupKeys::ADMIN_EMAIL) ?></param>
                        <param name="workerNumber" type="integer"><?php echo Setup::getValue(SetupKeys::CONTAINER_HTTPS_WORKER_NUMBER) ?></param>
                        <param name="workerAcceptMin" type="integer"><?php echo Setup::getValue(SetupKeys::CONTAINER_SERVER_WORKER_ACCEPT_MIN) ?></param>
                        <param name="workerAcceptMax" type="integer"><?php echo Setup::getValue(SetupKeys::CONTAINER_SERVER_WORKER_ACCEPT_MAX) ?></param>
                        <param name="transport" type="string">ssl</param>
                        <param name="address" type="string"><?php echo Setup::getValue(SetupKeys::CONTAINER_HTTPS_HOST) ?></param>
                        <param name="port" type="integer"><?php echo Setup::getValue(SetupKeys::CONTAINER_HTTPS_PORT) ?></param>
                        <param name="documentRoot" type="string">webapps</param>
                        <param name="directoryIndex" type="string">index.dhtml index.do index.php index.html index.htm</param>
                        <param name="keepAliveMax" type="integer">64</param>
                        <param name="keepAliveTimeout" type="integer">5</param>
                        <param name="autoIndex" type="boolean">false</param>
                        <param name="errorsPageTemplatePath" type="string">resources/templates/www/error.phtml</param>
                        <param name="welcomePageTemplatePath" type="string">resources/templates/www/welcome.phtml</param>
                        <param name="autoIndexTemplatePath" type="string">resources/templates/www/auto_index.phtml</param>
                        <param name="certPath" type="string">etc/appserver/server.pem</param>
                        <param name="privateKeyPath" type="string"></param>
                        <param name="dhParamPath" type="string"></param>
                        <param name="passphrase" type="string"></param>
                        <param name="cryptoMethod" type="string">STREAM_CRYPTO_METHOD_TLSv1_0_SERVER | STREAM_CRYPTO_METHOD_TLSv1_1_SERVER | STREAM_CRYPTO_METHOD_TLSv1_2_SERVER</param>
                        <param name="peerName" type="string"></param>
                        <param name="verifyPeer" type="boolean">false</param>
                        <param name="verifyPeerName" type="boolean">false</param>
                        <param name="allowSelfSigned" type="boolean">true</param>
                        <param name="disableCompression" type="boolean">true</param>
                        <param name="honorCipherOrder" type="boolean">true</param>
                        <param name="ecdhCurve" type="string">secp384r1</param>
                        <param name="singleEcdhUse" type="boolean">true</param>
                        <param name="singleDhUse" type="boolean">true</param>
                        <param name="ciphers" type="string">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:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:AES128:AES256:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK</param>
                    </params>

                    <!-- By default, we want to send additional response headers to improve HTTPS security -->
                    <headers>
                        <header type="response" name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains; preload" />
                    </headers>

                    <!-- An example to activate a the auto index functionality on a custom directory -->
                    <!--
                    <locations>
                        <location condition="^\/example\/META-INF\/.*">
                            <params>
                                <param name="autoIndex" type="boolean">true</param>
                            </params>
                        </location>
                    </locations>
                    -->

                    <!-- An example for using different certificates based for specific domains -->
                    <!--
                    <certificates>
                        <certificate domain="appserver.dev" certPath="etc/appserver/server.pem" />
                        <certificate domain="*.appserver.dev" certPath="etc/appserver/server.pem" />
                    </certificates>
                    -->
                    <environmentVariables>
                        <environmentVariable condition="" definition="LOGGER_ACCESS=Access" />
                    </environmentVariables>

                    <connectionHandlers>
                        <connectionHandler type="\AppserverIo\WebServer\ConnectionHandlers\HttpConnectionHandler" />
                    </connectionHandlers>

                    <!-- An example for basic or digest auth for the server -->
                    <!--
                    <authentications>
                        <authentication uri="^\/auth\/basic\/.*">
                            <params>
                                <param name="type" type="string">\AppserverIo\Http\Authentication\BasicAuthentication</param>
                                <param name="realm" type="string">PhpWebServer Basic Authentication System</param>
                                <param name="file" type="string">var/www/auth/basic/.htpasswd</param>
                            </params>
                        </authentication>
                        <authentication uri="^\/auth\/digest\/.*">
                            <params>
                                <param name="type" type="string">\AppserverIo\Http\Authentication\DigestAuthentication</param>
                                <param name="realm" type="string">appserver.io Digest Authentication System</param>
                                <param name="file" type="string">var/www/auth/digest/.htpasswd</param>
                            </params>
                        </authentication>
                    </authentications>
                    -->

                    <accesses>
                        <!-- per default allow everything -->
                        <access type="allow">
                            <params>
                                <param name="X_REQUEST_URI" type="string">.*</param>
                            </params>
                        </access>
                    </accesses>

                    <!-- include of virtual host configurations -->
                    <xi:include href="conf.d/virtual-hosts.xml"/>

                    <modules>
                        <!-- REQUEST_POST hook -->
                        <module type="\AppserverIo\WebServer\Modules\VirtualHostModule"/>
                        <module type="\AppserverIo\WebServer\Modules\AuthenticationModule"/>
                        <module type="\AppserverIo\WebServer\Modules\EnvironmentVariableModule" />
                        <module type="\AppserverIo\WebServer\Modules\RewriteModule"/>
                        <module type="\AppserverIo\WebServer\Modules\DirectoryModule"/>
                        <module type="\AppserverIo\WebServer\Modules\AccessModule"/>
                        <module type="\AppserverIo\WebServer\Modules\LocationModule"/>
                        <module type="\AppserverIo\WebServer\Modules\AutoIndexModule"/>
                        <!-- FileHandler Modules -->
                        <module type="\AppserverIo\WebServer\Modules\CoreModule"/>
                        <module type="\AppserverIo\WebServer\Modules\FcgiModule"/>
                        <module type="\AppserverIo\Appserver\ServletEngine\ServletEngine"/>
                        <module type="\AppserverIo\WebServer\Modules\ProxyModule"/>
                        <!-- RESPONSE_PRE hook -->
                        <module type="\AppserverIo\WebServer\Modules\HeaderModule"/>
                        <module type="\AppserverIo\WebServer\Modules\DeflateModule"/>
                        <!-- RESPONSE_POST hook -->
                        <!-- module type="\AppserverIo\Appserver\Core\Modules\ProfileModule"/ -->
                    </modules>

                    <fileHandlers>
                        <fileHandler name="fastcgi" extension=".php">
                            <params>
                                <param name="host" type="string"><?php echo Setup::getValue(SetupKeys::PHP_FPM_HOST) ?></param>
                                <param name="port" type="integer"><?php echo Setup::getValue(SetupKeys::PHP_FPM_PORT) ?></param>
                            </params>
                        </fileHandler>
                        <fileHandler name="fastcgi" extension=".phtml">
                            <params>
                                <param name="host" type="string"><?php echo Setup::getValue(SetupKeys::PHP_FPM_HOST) ?></param>
                                <param name="port" type="integer"><?php echo Setup::getValue(SetupKeys::PHP_FPM_PORT) ?></param>
                            </params>
                        </fileHandler>
                        <fileHandler name="servlet" extension=".dhtml" />
                        <fileHandler name="servlet" extension=".do" />
                    </fileHandlers>

                </server>

            </servers>
        </container>

    </containers>

</appserver>
