# # appweb.conf -- Appweb unit testing configuration # # WARNING: Do not use this appweb.conf as a sample for your application. It configures everything # possible: all handlers, filters, caching, limits, hosts and many applications. The result is a large # single web server to test everything. Have a look at src/server/appweb.conf and use that as the base # for your applications. # # ErrorLog error.log level=1 Log rx conn=5 first=2 headers=3 body=5 limits=5 size=10K exclude="jpg,gif,png,ico,css,js" Log tx first=3 headers=3 body=5 limits=5 time=6 size=10K exclude="jpg,gif,png,ico,css,js" Listen 8080 # Documents /www DirectoryIndex index.html LoadModulePath /usr/local/appweb DocumentRoot /www ServerRoot /www Cache 1hour ExitTimeout 10secs RequestParseTimeout 300secs InactivityTimeout 300secs RequestTimeout 1min SessionTimeout 30mins MemoryPolicy restart LimitBuffer 32K LimitCache 1MB LimitCacheItem 512K LimitChunk 32K LimitClients 20 LimitFiles 0 LimitKeepAlive 400 LimitMemory 300MB LimitProcesses 100 LimitRequests 400 LimitRequestsPerClient 200 LimitRequestBody 100MB LimitRequestForm 32K LimitRequestHeader 128K LimitRequestHeaderLines 128 LimitResponseBody 6GB LimitUpload 2GB LimitUri 64K LimitWorkers 50 UploadAutoDelete on SetConnector netConnector AddOutputFilter rangeFilter AddOutputFilter chunkFilter AddInputFilter uploadFilter AddHandler fileHandler html gif jpeg jpg png pdf ico css js "" Options Indexes IndexOrder ascending name IndexOptions FancyIndexing FoldersFirst LoadModule ejsHandler libmod_ejs # UnloadModule ejsHandler 60 AddHandler ejsHandler ejs es mob # EjsStartup start.es AddHandler errorHandler ejs es # # Sample for how to add an Ejscript application. # This maps the URI "/junk" to the application in the ./junk directory using the # junk/start.es script to respond to requests. Up to ten workers may be used by this app. # # EjsAlias /junk ./junk junk/start.es 10 # # Enable the action handler for simple URI to "C" bindings # This is used by the web-form Auth mech # SetHandler actionHandler LoadModule phpHandler libmod_php AddHandler phpHandler php AddHandler errorHandler php LoadModule espHandler libmod_esp # UnloadModule espHandler 60 AddHandler espHandler esp AddHandler espHandler xesp EspUpdate on EspShowErrors on EspKeepSource on # EspApp /app app restful mdb://app/test.mdb # # Prefix /app # Documents app # AddHandler espHandler # EspDir mvc # EspRouteSet restful # EspDb mdb://test.mdb # # Load a flat ESP application # # EspLoad app app/cache/app # # # Equivalent definition to EspApp # Prefix /app2 Documents app AddHandler espHandler EspDir mvc EspRouteSet restful # # EspRoute name methods pattern target source # EspRoute /app/sub/default GET ^/sub/{controller}/{action} ${controller}-${action} ${controller}.c # EspRouteSet restful # EspResource sys mid # EspResource user, system # EspResourceGroup post # # EspRoute default GET ^/{controller}/{action} ${controller}-${action} ${controller}.c # EspRouteSet mvc /prefix controller # EspRouteSet restful /prefix controller # # Dynamically loaded controller. The source code in sample.c will be automatically compiled and loaded. # Source code for sample.c: # # ESP_EXPORT int esp_module_sample(HttpRoute *route, MprModule *module) { # // Bound to http://IP/mytest/ACTION # espDefineAction(route, "mytest-ACTION", action); # return 0; # } # # # AddHandler espHandler # Source sample.c # Target run mytest-$1 # AddHandler errorHandler esp LoadModule cgiHandler libmod_cgi AddHandler cgiHandler exe cgi cgi-nph bat cmd pl py ScriptAlias /cgi-bin/ "${SERVER_ROOT}/cgi-bin/" Action application/x-perl /usr/bin/perl Action application/x-python /usr/bin/python Action application/x-lua /usr/bin/lua Action application/x-ruby /usr/bin/ruby Action application/x-php /usr/local/bin/php-cgi AddHandler errorHandler exe cgi cgi-nph bat cmd pl py # # Test route pattern matching # The {2} means match exactly 2 of the previous character Name route/fullpat.tst Target write 200 "${cmd}" Name token.tst Target write 200 "${cmd}-${request:query}" Name route/optional.tst Target write 200 "${controller}-${action}" Name route/missing.tst Prefix /route/missing-ext SetHandler phpHandler Condition exists ${request:filename} Target run $1.php # AuthStore system|file #include auth.conf Name route/auth.tst Prefix /route/auth Documents "${DOCUMENT_ROOT}/basic" AuthType basic example.com # # Language tests # Prefix /lang/root Name lang/root.tst AddLanguageDir en english Name lang/suffix.tst Prefix /lang/suffix AddLanguageSuffix en en before Name lang/target.tst Prefix /lang/target AddLanguageSuffix en en Target run $1.${request:Language=ge}$2 Name lang/default.tst Prefix /lang/default AddLanguageSuffix fr fr DefaultLanguage fr Target run $1.${request:Language}$2 # Target run ${DOCUMENT_ROOT}/$1.${request:Language}$2 Name lang/catchall.tst Prefix /lang/catchall AddLanguageSuffix "" en before # # Header and Param tests # Name route/header.tst Header User-Agent custom Target write 200 "${header:User-Agent}" Name route/param.tst Param name peter Target write 200 "${param:name}" # # Condition tests # Name route/cond.tst Condition ! match ${request:scheme} "(https|custom)" Target write 200 "${request:scheme}" # # Updates # Name route/cmd.tst Update cmd "touch route-update-cmd.tmp" Target write 200 "${request:error}UPDATED" Name route/var.tst Update param from ${header:from} Target write 200 "${param:from}" # # Misc # Name compress/gzip.tst Compress gzip # # Enable PUT|DELETE # Documents web/tmp Prefix /tmp PutMethod on SetHandler fileHandler # # Enable TRACE # Prefix /trace TraceMethod on # Sample to restrict to specific named methods # Default is to allow all methods sans DELETE, PUT, TRACE. Prefix /get Methods GET, OPTIONS # # Test caching modes: all, unique, only # Prefix /only Documents web/caching # Cache only these exact URIs with request params Cache client=30mins server=1day only /cache.esp?esp=1&prefix=/only /cache.php?php=1&prefix=/only /cache.ejs?ejs=1&prefix=/only Prefix /combined Documents web/caching # Cache these URIs with any request params combined into one item per URI Cache server=1day all /cache.esp /cache.php /cache.ejs /cache.cgi Prefix /unique Documents web/caching # Cache each URI+params uniquely Cache server=1day unique /cache.esp /cache.php /cache.ejs /cache.cgi Prefix /ext Documents web/caching Cache server extensions="esp" Prefix /types Documents web/caching Cache server types="application/x-php" Prefix /methods Documents web/caching Cache server methods="POST" # Re-open the existing default route and add caching # Note: /cache is the controller name Cache 1day Cache server manual /cache/manual Cache server all /cache/small /cache/big /cache/huge Cache client=1hr /cache/client # Limit to prevent huge being cached LimitCacheItem 100000 # AccessLog app.log size=1MB append anew Alias /SimpleAlias "${DOCUMENT_ROOT}" Alias /aliasDir/ ${DOCUMENT_ROOT}/alias/ Alias /aliasFile ${DOCUMENT_ROOT}/alias/atest.html Alias /AliasDocs/ "${DOCUMENT_ROOT}/My Documents/" ScriptAlias /MyScripts/ "${SERVER_ROOT}/cgi-bin/" ScriptAlias /YourScripts/ "${DOCUMENT_ROOT}/" # # Routes with basic, digest and form-based authentication # AuthType basic example.com Require role executive Require user joshua AuthType digest example.com Require role executive Require user joshua AuthType form example.com https:///auth/form/login.esp https:///auth/form/login /auth/form/logout /auth/form/index.html # # Test error documents # # Remote URIs and Ejscript will redirect with a 302 status code ErrorDocument 404 /notFound.esp # # Test simple redirections # Redirect temp /old.html /index.html Redirect 410 /membersOnly # # WebSockets test # Prefix /websockets ResetPipeline AddFilter webSocketFilter AddHandler espHandler Documents src Source websockets.c Target run $1-$2 LimitWebSockets 25 LimitWebSocketsMessage 2GB LimitWebSocketsPacket 8K LimitWebSocketsFrame 4K RequestTimeout 1hr InactivityTimeout 2mins WebSocketsProtocol chat # WebSocketsPing 30secs # IgnoreEncodingErrors on # # Appweb documentation # Documents /Users/mob/git/appweb/doc Prefix /doc Prefix /secure-only Require secure age=30days domains LoadModule sslModule libmod_ssl # # Define the TLS endpoint without requiring a virtual host # ListenSecure 127.0.0.1:4443 # SSLCACertificateFile "crt/ca.crt" # For client-cert verification (signed test.crt) SSLCertificateFile "crt/test.crt" SSLCertificateKeyFile "crt/test.key" # # Virtual hosts for SSL certificate tests # ListenSecure 127.0.0.1:5443 # # SSLProvider est SSLCertificateFile "crt/self.crt" SSLCertificateKeyFile "crt/self.key" ListenSecure 127.0.0.1:6443 # # SSLProvider est SSLVerifyClient on # Not required to set cipher suite. Just testing it works. # SSLCipherSuite TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_RC4_128_SHA Prefix /ssl-match Condition match ${ssl:CLIENT_S_CN} "localhost|example.com" # Condition match ${ssl:state} "CN=localhost," # # Provider specific virtual hosts # ListenSecure 127.0.0.1:7443 # SSLProvider openssl SSLCipherSuite AES128-SHA # HIGH:RC4+SHA SSLVerifyClient on ListenSecure 127.0.0.1:8443 # SSLProvider matrixssl SSLVerifyClient on ListenSecure 127.0.0.1:9443 # SSLProvider nanossl SSLVerifyClient off Listen 127.0.0.1:4200 # NameVirtualHost *:4200 ServerName localhost:4200 Documents "${SERVER_ROOT}/web/vhost/namehost1" ServerName 127.0.0.1:4200 Documents "${SERVER_ROOT}/web/vhost/namehost2" ResetPipeline AddHandler fileHandler html gif jpeg jpg png pdf ico css js "" AddHandler ejsHandler ejs DirectoryIndex index.ejs AddHandler errorHandler ejs # # IP virtual host # Listen 127.0.0.1:4300 # Documents "${SERVER_ROOT}/web/vhost/iphost" AuthType basic example.com Require user mary include conf/*.conf include apps/*.conf # LogRoutes full # LogRoutes