556 lines
14 KiB
Plaintext
556 lines
14 KiB
Plaintext
#
|
|
# 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 # <HTTPv4>
|
|
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 ""
|
|
|
|
<if DIR_MODULE>
|
|
Options Indexes
|
|
IndexOrder ascending name
|
|
IndexOptions FancyIndexing FoldersFirst
|
|
</if>
|
|
|
|
<if EJS_MODULE>
|
|
LoadModule ejsHandler libmod_ejs
|
|
# UnloadModule ejsHandler 60
|
|
AddHandler ejsHandler ejs es mob
|
|
# EjsStartup start.es
|
|
<else>
|
|
AddHandler errorHandler ejs es
|
|
</if>
|
|
|
|
#
|
|
# 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
|
|
#
|
|
<Route ^/action/>
|
|
SetHandler actionHandler
|
|
</Route>
|
|
|
|
<if PHP_MODULE>
|
|
LoadModule phpHandler libmod_php
|
|
AddHandler phpHandler php
|
|
<else>
|
|
AddHandler errorHandler php
|
|
</if>
|
|
|
|
<if ESP_MODULE>
|
|
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
|
|
# <Route ^/app$>
|
|
# Prefix /app
|
|
# Documents app
|
|
# AddHandler espHandler
|
|
# EspDir mvc
|
|
# EspRouteSet restful
|
|
# EspDb mdb://test.mdb
|
|
#
|
|
# Load a flat ESP application
|
|
#
|
|
# EspLoad app app/cache/app
|
|
# </Route>
|
|
|
|
#
|
|
# Equivalent definition to EspApp
|
|
#
|
|
<Route ^/app2>
|
|
Prefix /app2
|
|
Documents app
|
|
AddHandler espHandler
|
|
EspDir mvc
|
|
EspRouteSet restful
|
|
</Route>
|
|
|
|
# <Route ${inherit}/sub>
|
|
# 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
|
|
# </Route>
|
|
|
|
# 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;
|
|
# }
|
|
#
|
|
# <Route ^/sample/{action}$>
|
|
# AddHandler espHandler
|
|
# Source sample.c
|
|
# Target run mytest-$1
|
|
# </Route>
|
|
<else>
|
|
AddHandler errorHandler esp
|
|
</if>
|
|
|
|
<if CGI_MODULE>
|
|
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
|
|
<else>
|
|
AddHandler errorHandler exe cgi cgi-nph bat cmd pl py
|
|
</if>
|
|
|
|
#
|
|
# Test route pattern matching
|
|
# The {2} means match exactly 2 of the previous character
|
|
<Route ^/route/(user|admin)/{cmd}/[^a-z]\{2}(\.[hH][tT][mM][lL])$>
|
|
Name route/fullpat.tst
|
|
Target write 200 "${cmd}"
|
|
</Route>
|
|
|
|
<Route ^/route/tokens/{cmd}$>
|
|
Name token.tst
|
|
Target write 200 "${cmd}-${request:query}"
|
|
</Route>
|
|
|
|
<Route ^/route/optional/{controller}(~/{action}~) >
|
|
Name route/optional.tst
|
|
Target write 200 "${controller}-${action}"
|
|
</Route>
|
|
|
|
<if PHP_MODULE>
|
|
<Route ^/route/missing-ext/((?!\.php).*)$>
|
|
Name route/missing.tst
|
|
Prefix /route/missing-ext
|
|
SetHandler phpHandler
|
|
Condition exists ${request:filename}
|
|
Target run $1.php
|
|
</Route>
|
|
</if>
|
|
|
|
# AuthStore system|file
|
|
#include auth.conf
|
|
|
|
<Route ^/route/auth>
|
|
Name route/auth.tst
|
|
Prefix /route/auth
|
|
Documents "${DOCUMENT_ROOT}/basic"
|
|
AuthType basic example.com
|
|
</Route>
|
|
|
|
#
|
|
# Language tests
|
|
#
|
|
<Route ^/lang/root>
|
|
Prefix /lang/root
|
|
Name lang/root.tst
|
|
AddLanguageDir en english
|
|
</Route>
|
|
|
|
<Route ^/lang/suffix>
|
|
Name lang/suffix.tst
|
|
Prefix /lang/suffix
|
|
AddLanguageSuffix en en before
|
|
</Route>
|
|
|
|
<Route ^/lang/target/(.*)(\.html)$>
|
|
Name lang/target.tst
|
|
Prefix /lang/target
|
|
AddLanguageSuffix en en
|
|
Target run $1.${request:Language=ge}$2
|
|
</Route>
|
|
|
|
<Route ^/lang/default/(.*)(\.html)$>
|
|
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
|
|
</Route>
|
|
|
|
<Route ^/lang/catchall>
|
|
Name lang/catchall.tst
|
|
Prefix /lang/catchall
|
|
AddLanguageSuffix "" en before
|
|
</Route>
|
|
|
|
#
|
|
# Header and Param tests
|
|
#
|
|
<Route ^/route/header>
|
|
Name route/header.tst
|
|
Header User-Agent custom
|
|
Target write 200 "${header:User-Agent}"
|
|
</Route>
|
|
|
|
<Route ^/route/param>
|
|
Name route/param.tst
|
|
Param name peter
|
|
Target write 200 "${param:name}"
|
|
</Route>
|
|
|
|
#
|
|
# Condition tests
|
|
#
|
|
<Route ^/route/cond>
|
|
Name route/cond.tst
|
|
Condition ! match ${request:scheme} "(https|custom)"
|
|
Target write 200 "${request:scheme}"
|
|
</Route>
|
|
|
|
#
|
|
# Updates
|
|
#
|
|
<Route ^/route/update/cmd>
|
|
Name route/cmd.tst
|
|
Update cmd "touch route-update-cmd.tmp"
|
|
Target write 200 "${request:error}UPDATED"
|
|
</Route>
|
|
|
|
<Route ^/route/update/var>
|
|
Name route/var.tst
|
|
Update param from ${header:from}
|
|
Target write 200 "${param:from}"
|
|
</Route>
|
|
|
|
#
|
|
# Misc
|
|
#
|
|
<Route ^/compress/>
|
|
Name compress/gzip.tst
|
|
Compress gzip
|
|
</Route>
|
|
|
|
#
|
|
# Enable PUT|DELETE
|
|
#
|
|
<Route ^/tmp/>
|
|
Documents web/tmp
|
|
Prefix /tmp
|
|
PutMethod on
|
|
SetHandler fileHandler
|
|
</Route>
|
|
|
|
#
|
|
# Enable TRACE
|
|
#
|
|
<Route ^/trace/>
|
|
Prefix /trace
|
|
TraceMethod on
|
|
</Route>
|
|
|
|
# Sample to restrict to specific named methods
|
|
# Default is to allow all methods sans DELETE, PUT, TRACE.
|
|
<Route /get>
|
|
Prefix /get
|
|
Methods GET, OPTIONS
|
|
</Route>
|
|
|
|
#
|
|
# Test caching modes: all, unique, only
|
|
#
|
|
<Route ^/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
|
|
</Route>
|
|
<Route ^/combined/>
|
|
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
|
|
</Route>
|
|
<Route ^/unique/>
|
|
Prefix /unique
|
|
Documents web/caching
|
|
# Cache each URI+params uniquely
|
|
Cache server=1day unique /cache.esp /cache.php /cache.ejs /cache.cgi
|
|
</Route>
|
|
<Route ^/ext/>
|
|
Prefix /ext
|
|
Documents web/caching
|
|
Cache server extensions="esp"
|
|
</Route>
|
|
<Route ^/types/>
|
|
Prefix /types
|
|
Documents web/caching
|
|
Cache server types="application/x-php"
|
|
</Route>
|
|
<Route ^/methods/>
|
|
Prefix /methods
|
|
Documents web/caching
|
|
Cache server methods="POST"
|
|
</Route>
|
|
|
|
# Re-open the existing default route and add caching
|
|
<Route ^/app/*/default>
|
|
# 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
|
|
</Route>
|
|
|
|
|
|
Alias /SimpleAlias "${DOCUMENT_ROOT}"
|
|
Alias /aliasDir/ ${DOCUMENT_ROOT}/alias/
|
|
Alias /aliasFile ${DOCUMENT_ROOT}/alias/atest.html
|
|
Alias /AliasDocs/ "${DOCUMENT_ROOT}/My Documents/"
|
|
|
|
<if CGI_MODULE>
|
|
ScriptAlias /MyScripts/ "${SERVER_ROOT}/cgi-bin/"
|
|
ScriptAlias /YourScripts/ "${DOCUMENT_ROOT}/"
|
|
</if>
|
|
|
|
#
|
|
# Routes with basic, digest and form-based authentication
|
|
#
|
|
<Route ^/auth/basic/>
|
|
AuthType basic example.com
|
|
<Route ^/auth/basic/executive/>
|
|
Require role executive
|
|
</Route>
|
|
<Route ^/auth/basic/joshua/>
|
|
Require user joshua
|
|
</Route>
|
|
</Route>
|
|
|
|
<Route ^/auth/digest/>
|
|
AuthType digest example.com
|
|
<Route ^/auth/digest/executive/>
|
|
Require role executive
|
|
</Route>
|
|
<Route ^/auth/digest/joshua/>
|
|
Require user joshua
|
|
</Route>
|
|
</Route>
|
|
|
|
<Route ^/auth/form/>
|
|
AuthType form example.com https:///auth/form/login.esp https:///auth/form/login /auth/form/logout /auth/form/index.html
|
|
</Route>
|
|
|
|
#
|
|
# Test error documents
|
|
#
|
|
<Route ^/error/>
|
|
# Remote URIs and Ejscript will redirect with a 302 status code
|
|
ErrorDocument 404 /notFound.esp
|
|
</Route>
|
|
|
|
#
|
|
# Test simple redirections
|
|
#
|
|
Redirect temp /old.html /index.html
|
|
Redirect 410 /membersOnly
|
|
|
|
#
|
|
# WebSockets test
|
|
#
|
|
<Route ^/websockets/{controller}/{action}$>
|
|
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
|
|
</Route>
|
|
|
|
#
|
|
# Appweb documentation
|
|
#
|
|
<Route ^/doc/>
|
|
Documents /Users/mob/git/appweb/doc
|
|
Prefix /doc
|
|
</Route>
|
|
|
|
<Route ^/secure-only>
|
|
Prefix /secure-only
|
|
Require secure age=30days domains
|
|
</Route>
|
|
|
|
<if SSL_MODULE>
|
|
LoadModule sslModule libmod_ssl
|
|
|
|
#
|
|
# Define the TLS endpoint without requiring a virtual host
|
|
#
|
|
ListenSecure 127.0.0.1:4443 # <HTTPSv4>
|
|
|
|
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
|
|
#
|
|
<VirtualHost *:5443>
|
|
ListenSecure 127.0.0.1:5443 # <SELFCERT>
|
|
# SSLProvider est
|
|
SSLCertificateFile "crt/self.crt"
|
|
SSLCertificateKeyFile "crt/self.key"
|
|
</VirtualHost>
|
|
|
|
<VirtualHost *:6443>
|
|
ListenSecure 127.0.0.1:6443 # <CLIENTCERT>
|
|
# 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
|
|
|
|
<Route /ssl-match>
|
|
Prefix /ssl-match
|
|
Condition match ${ssl:CLIENT_S_CN} "localhost|example.com"
|
|
</Route>
|
|
# Condition match ${ssl:state} "CN=localhost,"
|
|
|
|
</VirtualHost>
|
|
|
|
#
|
|
# Provider specific virtual hosts
|
|
#
|
|
<VirtualHost *:7443>
|
|
ListenSecure 127.0.0.1:7443 # <OPENSSL>
|
|
SSLProvider openssl
|
|
SSLCipherSuite AES128-SHA # HIGH:RC4+SHA
|
|
SSLVerifyClient on
|
|
</VirtualHost>
|
|
|
|
<VirtualHost *:8443>
|
|
ListenSecure 127.0.0.1:8443 # <MATRIXSSL>
|
|
SSLProvider matrixssl
|
|
SSLVerifyClient on
|
|
</VirtualHost>
|
|
|
|
<VirtualHost *:9443>
|
|
ListenSecure 127.0.0.1:9443 # <NANOSSL>
|
|
SSLProvider nanossl
|
|
SSLVerifyClient off
|
|
</VirtualHost>
|
|
</if>
|
|
|
|
Listen 127.0.0.1:4200 # <NAMED>
|
|
NameVirtualHost *:4200
|
|
<VirtualHost *:4200>
|
|
ServerName localhost:4200
|
|
Documents "${SERVER_ROOT}/web/vhost/namehost1"
|
|
</VirtualHost>
|
|
|
|
<VirtualHost *:4200>
|
|
ServerName 127.0.0.1:4200
|
|
Documents "${SERVER_ROOT}/web/vhost/namehost2"
|
|
ResetPipeline
|
|
AddHandler fileHandler html gif jpeg jpg png pdf ico css js ""
|
|
<if EJS_MODULE>
|
|
AddHandler ejsHandler ejs
|
|
DirectoryIndex index.ejs
|
|
<else>
|
|
AddHandler errorHandler ejs
|
|
</if>
|
|
</VirtualHost>
|
|
|
|
#
|
|
# IP virtual host
|
|
#
|
|
Listen 127.0.0.1:4300 # <IPHOST>
|
|
<VirtualHost *:4300>
|
|
Documents "${SERVER_ROOT}/web/vhost/iphost"
|
|
AuthType basic example.com
|
|
Require user mary
|
|
</VirtualHost>
|
|
|
|
include conf/*.conf
|
|
include apps/*.conf
|
|
|
|
# LogRoutes full
|
|
# LogRoutes
|
|
|