appserver-io/webserver

View on GitHub
etc/webserver.json

Summary

Maintainability
Test Coverage
{
    "description": "This is an example of a php WebServer configuration in json",

    "loggers": [
        {
            "name": "System",
            "type": "\\Monolog\\Logger",
            "handlers": [
                {
                    "type": "\\Monolog\\Handler\\StreamHandler",
                    "params": {
                        "stream": "var/log/webserver-system.log",
                        "level": 100,
                        "bubble": 1
                    }
                }
            ]
        },
        {
            "name": "Access",
            "type": "\\Monolog\\Logger",
            "handlers": [
                {
                    "type": "\\Monolog\\Handler\\StreamHandler",
                    "formatter": {
                        "type": "\\Monolog\\Formatter\\LineFormatter",
                        "params": {
                            "format": "%message%",
                            "dateFormat": "Y-m-d H:i:s",
                            "allowInlineLineBreaks": 1
                        }
                    },
                    "params": {
                        "stream": "var/log/webserver-access.log",
                        "level": 100,
                        "bubble": 1
                    }
                }
            ]
        }
    ],
    "servers": [
        {
            "name": "httpServer",
            "type": "\\AppserverIo\\Server\\Servers\\MultiThreadedServer",
            "worker": "\\AppserverIo\\Server\\Workers\\ThreadWorker",
            "socket": "\\AppserverIo\\Server\\Sockets\\StreamSocket",
            "serverContext": "\\AppserverIo\\Server\\Contexts\\ServerContext",
            "requestContext": "\\AppserverIo\\Server\\Contexts\\RequestContext",
            "streamContext": "\\AppserverIo\\Server\\Contexts\\StreamContext",
            "loggerName": "System",
            "workerNumber": 128,
            "workerAcceptMin": 8,
            "workerAcceptMax": 16,

            "admin": "www@localhost.localdomain",
            "software": "phpWebServer/0.2.0",
            "transport": "tcp",
            "address": "0.0.0.0",
            "port": "9080",
            "documentRoot": "var/www",
            "directoryIndex": "index.php index.html index.htm",
            "keepAliveMax": 64,
            "keepAliveTimeout": 5,
            "autoIndex": true,
            "errorsPageTemplatePath": "resources/templates/www/error.phtml",
            "welcomeTemplatePath": "resources/templates/www/welcome.phtml",
            "autoIndexTemplatePath": "resources/templates/www/auto_index.phtml",

            "authentications": [
                {
                    "uri": "^\\/auth\\/basic\\/phpwebserver.*",
                    "realm": "PhpWebServer Basic Authentication System",
                    "type": "\\AppserverIo\\Http\\Authentication\\BasicAuthentication",
                    "hash": "cGhwd2Vic2VydmVyOnBocHdlYnNlcnZlci5pMA=="
                },
                {
                    "uri": "^\\/auth\\/basic\\/appserver.*",
                    "realm": "appserver.io Basic Authentication System",
                    "type": "\\AppserverIo\\Http\\Authentication\\BasicAuthentication",
                    "hash": "YXBwc2VydmVyOmFwcHNlcnZlci5pMA=="
                }
            ],

            "accesses": [
                {
                    "type": "allow",
                    "REQUEST_URI": ".*"
                }
            ],

            "rewrites": [
                {
                    "condition": "-f{OR}-l{OR}-d",
                    "target": "",
                    "flag": "L"
                }
            ],

            "virtualHosts": [
                {
                    "name": "phpwebserver.dev phpwebserver.local phpwebserver.test",
                    "admin": "admin@phpwebserver.dev",
                    "documentRoot": "var/www",
                    "rewrites": [
                        {
                            "condition": "-f{OR}-l{OR}-d",
                            "target": "",
                            "flag": "L"
                        }
                    ],
                    "environmentVariables": [
                        {
                            "condition": "",
                            "definition": "EXAMPLE_VARIABLE=test"
                        }
                    ]
                },
                {
                    "name": "phpwebserver-fcgi.dev phpwebserver-fcgi.local phpwebserver-fcgi.test",
                    "admin": "admin@phpwebserver.dev",
                    "documentRoot": "var/www/cgi",
                    "rewrites": [
                        {
                            "condition": "-f{OR}-l{OR}-d",
                            "target": "",
                            "flag": "L"
                        }
                    ],
                    "environmentVariables": [
                        {
                            "condition": "",
                            "definition": "EXAMPLE_VARIABLE=fastcgi"
                        }
                    ],
                    "locations": [
                        {
                            "condition": "~*\\.php(\\\/|\\?|$",
                            "handlers": [
                                {
                                    "name": "fastcgi",
                                    "extension": ".php",
                                    "params": {
                                        "host": "127.0.0.1",
                                        "port": 9000
                                    }
                                }
                            ]
                        }
                    ]
                },
                {
                    "name": "magento.local",
                    "admin": "admin@magento.local",
                    "documentRoot": "/var/www/magento",
                    "rewriteMaps": [
                        {
                            "type": "\\AppserverIo\\WebServer\\Modules\\MagentoRewriteMapper",
                            "params": {
                                "base": "instance-subdir",
                                "dsn": "mysql:host=127.0.0.1;dbname=magento;charset=utf8",
                                "username": "user",
                                "password": "pass"
                            }
                        }
                    ],
                    "rewrites": [
                        {
                            "condition": "-f{OR}-l{OR}-d",
                            "target": "",
                            "flag": "L"
                        }
                    ],
                    "accesses": [
                        {
                            "type": "allow",
                            "REQUEST_URI": "^\\/(media|skin|js|index\\.php).*"
                        }
                    ]
                }
            ],

            "environmentVariables": [
                {
                    "condition": "(\\s.*WebKit?|Gecko)@$User-Agent",
                    "definition": "BROWSER_ENGINE=$1"
                }
            ],

            "connectionHandlers": [
                "\\AppserverIo\\WebServer\\ConnectionHandlers\\HttpConnectionHandler"
            ],

            "modules": [
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\AuthenticationModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\VirtualHostModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\EnvironmentVariableModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\RewriteMapModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\DirectoryModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\AccessModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\LocationModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\AutoIndexModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\CoreModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\PhpModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\FcgiModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\DeflateModule"
                }
            ],

            "handlers": [
                {"name": "php", "extension": ".php"},
                {"name": "php", "extension": ".phtml"},
                {"name": "servlet", "extension": ".do"}
            ]
        },
        {
            "name": "httpsServer",
            "type": "\\AppserverIo\\Server\\Servers\\MultiThreadedServer",
            "worker": "\\AppserverIo\\Server\\Workers\\ThreadWorker",
            "socket": "\\AppserverIo\\Server\\Sockets\\StreamSocket",
            "serverContext": "\\AppserverIo\\Server\\Contexts\\ServerContext",
            "requestContext": "\\AppserverIo\\Server\\Contexts\\RequestContext",
            "streamContext": "\\AppserverIo\\Server\\Contexts\\StreamContext",
            "loggerName": "System",
            "workerNumber": 128,
            "workerAcceptMin": 8,
            "workerAcceptMax": 16,
            "admin": "www@localhost.localdomain",
            "software": "phpWebServer/0.2.0",
            "transport": "ssl",
            "address": "0.0.0.0",
            "port": "9443",
            "documentRoot": "var/www",
            "directoryIndex": "index.php index.html index.htm",
            "keepAliveMax": 64,
            "keepAliveTimeout": 5,
            "autoIndex": true,
            "errorsPageTemplatePath": "resources/templates/www/error.phtml",
            "welcomeTemplatePath": "resources/templates/www/welcome.phtml",
            "autoIndexTemplatePath": "resources/templates/www/auto_index.phtml",
            "certPath": "etc/phpwebserver.pem",
            "passphrase": "passphrase",
            "cryptoMethod": "STREAM_CRYPTO_METHOD_TLSv1_0_SERVER | STREAM_CRYPTO_METHOD_TLSv1_1_SERVER | STREAM_CRYPTO_METHOD_TLSv1_2_SERVER",
            "peerName": "",
            "verifyPeer": false,
            "verifyPeerName": false,
            "allowSelfSigned": true,
            "disableCompression": true,
            "honorCipherOrder": true,
            "ecdhCurve": "secp384r1",
            "singleEcdhUse": true,
            "singleDhUse": true,
            "certificates": [
                {
                    "domain": "phpwebserver.dev",
                    "certPath": "etc/webserver.pem"
                },
                {
                    "domain": "phpwebserver.local",
                    "certPath": "etc/webserver1.pem"
                },
                {
                    "domain": "phpwebserver.test",
                    "certPath": "etc/webserver2.pem"
                }
            ],

            "authentications": [
                {
                    "uri": "^\\/auth\\/basic\\/phpwebserver.*",
                    "realm": "PhpWebServer Basic Authentication System",
                    "type": "\\AppserverIo\\WebServer\\Authentication\\BasicAuthentication",
                    "hash": "cGhwd2Vic2VydmVyOnBocHdlYnNlcnZlci5pMA=="
                },
                {
                    "uri": "^\\/auth\\/basic\\/appserver.*",
                    "realm": "appserver.io Basic Authentication System",
                    "type": "\\AppserverIo\\WebServer\\Authentication\\BasicAuthentication",
                    "hash": "YXBwc2VydmVyOmFwcHNlcnZlci5pMA=="
                }
            ],

            "accesses": [
                {
                    "type": "allow",
                    "REQUEST_URI": ".*"
                }
            ],

            "rewrites": [
                {
                    "condition": "-f{OR}-l{OR}-d",
                    "target": "",
                    "flag": "L"
                }
            ],

            "virtualHosts": [
                {
                    "name": "phpwebserver.dev phpwebserver.local phpwebserver.test",
                    "admin": "admin@phpwebserver.dev",
                    "documentRoot": "var/www",
                    "rewrites": [
                        {
                            "condition": "-f{OR}-l{OR}-d",
                            "target": "",
                            "flag": "L"
                        }
                    ],
                    "environmentVariables": [
                        {
                            "condition": "",
                            "definition": "EXAMPLE_VARIABLE=test"
                        }
                    ]
                },
                {
                    "name": "phpwebserver-fcgi.dev phpwebserver-fcgi.local phpwebserver-fcgi.test",
                    "admin": "admin@phpwebserver.dev",
                    "documentRoot": "var/www/cgi",
                    "rewrites": [
                        {
                            "condition": "-f{OR}-l{OR}-d",
                            "target": "",
                            "flag": "L"
                        }
                    ],
                    "environmentVariables": [
                        {
                            "condition": "",
                            "definition": "EXAMPLE_VARIABLE=fastcgi"
                        }
                    ],
                    "locations": [
                        {
                            "condition": "~*\\.php(\\\/|\\?|$",
                            "handlers": [
                                {
                                    "name": "fastcgi",
                                    "extension": ".php",
                                    "params": {
                                        "host": "127.0.0.1",
                                        "port": 9000
                                    }
                                }
                            ]
                        }
                    ]
                },
                {
                    "name": "magento.local",
                    "admin": "admin@magento.local",
                    "documentRoot": "/var/www/magento",
                    "rewriteMaps": [
                        {
                            "type": "\\AppserverIo\\WebServer\\Modules\\MagentoRewriteMapper",
                            "base": "instance-subdir",
                            "dsn": "mysql:host=127.0.0.1;dbname=magento;charset=utf8",
                            "username": "user",
                            "password": "pass"
                        }
                    ],
                    "rewrites": [
                        {
                            "condition": "-f{OR}-l{OR}-d",
                            "target": "",
                            "flag": "L"
                        }
                    ],
                    "accesses": [
                        {
                            "type": "allow",
                            "REQUEST_URI": "^\\/(media|skin|js|index\\.php).*"
                        }
                    ]
                }
            ],

            "environmentVariables": [
                {
                    "condition": "(\\s.*WebKit?|Gecko)@$User-Agent",
                    "definition": "BROWSER_ENGINE=$1"
                }
            ],

            "connectionHandlers": [
                "\\AppserverIo\\WebServer\\ConnectionHandlers\\HttpConnectionHandler"
            ],

            "modules": [
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\AuthenticationModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\VirtualHostModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\EnvironmentVariableModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\RewriteMapModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\DirectoryModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\AccessModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\LocationModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\AutoIndexModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\CoreModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\PhpModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\FcgiModule"
                },
                { 
                   "type" : "\\AppserverIo\\WebServer\\Modules\\DeflateModule"
                }
            ],

            "handlers": [
                {"name": "php", "extension": ".php"},
                {"name": "php", "extension": ".phtml"},
                {"name": "servlet", "extension": ".do"}
            ]
        }
    ]
}