关于appweb配置详解

来源:互联网 发布:淘宝diy u盘好 编辑:程序博客网 时间:2024/05/21 21:43
关于appweb配置详解
通常我们使用appweb.conf作为其默认的配置文件,当然也可以通过编程的方式调用API接口来进行配置。我将站在一个使用者的角度,对appweb.conf配置进行分析
我们在运行时可以指定定制的配置文件:
appweb --config myConfigFile.conf
appweb的配置与apache配置兼容,方便使用apache的管理者。
appweb.conf中每一行一条指令,比较高效,指令的顺序没有关系,另外也不区分大小写,以“#”表示注释
一个简单的配置:
    Home "."
    ErrorLog error.log
    ServerName http://localhost:7777
    Documents "/var/web"
    Listen 7777
    LoadModule fileHandler mod_file
    AddHandler fileHandler html
配置文件一般由几块组成:
    全局指令
    路由模块
    虚拟主机模块
路由模块    
    <Route "/myapp/">
        SetHandler esp
    </Route>
虚拟主机模块
    NameVirtualHost 206.148.96.56    
    <VirtualHost 206.148.97.56>
        Documents /var/www/mycorp
        ServerName www.myServer.com
        ...
    </VirtualHost>    
我们来详解一下VirtualHost
简单的说:它能让你以一台电脑创建多个网站。
NameVirtualHost指令能让你用一个IP绑定多个域名
NameVirtualHost 206.148.97.56
<VirtualHost 206.148.97.56>
    ServerName www.acme.com
    Documents /var/www/acme
    ...
</VirtualHost>
<VirtualHost 206.148.97.56>
    ServerName www.coyote.com
    Documents /var/www/coyote
    ...
</VirtualHost>
Include指令
可以包含其他文件
    Include myconfig.conf
    Include conf/applications/*.conf
条件指令
    <if FILE_MODULE>
    LoadModule fileHandler mod_file
    </if>
    
appweb.conf
{
    Home "./etc"
    ErrorLog error.log
    ServerName http://localhost:8080
    Documents "./webServer"
    Listen 8080
    DirectoryIndex index.html
    
    Cache                   1hour
    ExitTimeout             10secs
    RequestParseTimeout     30secs
    InactivityTimeout       30secs
    RequestTimeout          1min
    SessionTimeout          30mins
    MemoryPolicy            restart
    LimitBuffer             32K
    LimitCache              1MB
    LimitCacheItem          512K
    LimitChunk              32K
    LimitClients            20
    LimitFiles              0
    LimitKeepAlive          400
    LimitMemory             50MB
    LimitProcesses          100
    LimitRequests           400
    LimitRequestsPerClient  200
    LimitRequestBody        40MB
    LimitRequestForm        32K
    LimitRequestHeader      128K
    LimitRequestHeaderLines 128
    LimitResponseBody       6GB
    LimitUpload             10MB
    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 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>

    <if CGI_MODULE>
    ScriptAlias /MyScripts/ "${SERVER_ROOT}/cgi-bin/"
    ScriptAlias /YourScripts/ "${DOCUMENT_ROOT}/"
    </if>
}    
    
appweb4.3.4支持的所有配置指令:
AccessLog                                 Define the location and format of the access log.
Action                                         CGI program to handle specific content.
AddInputFilter                         Add an input filter to the processing pipeline.
AddHandler                                 Add a handler for processing given file extensions.
AddLanguageSuffix                 Add a supported language and filename suffix to use for this language.
AddLanguageDir                         Add a per-language content directory.
AddOutputFilter                     Add an output filter to the processing pipeline.
AddType                                     Add a MIME type specification.
Alias                                         Map URLs to directories.
Allow                                         Define which servers can access content.
AuthDigestQop                         Define the quality of protection for Digest Authentication.
AuthGroupFile                         Define the name of the user group file for authentication.
AuthStore                                 Define the authentication method: "file" or "system".
AuthName                                     Define the realm of users to be permitted access to this set of documents.
AuthType                                     Define the type of authentication to use: Basic or Digest.
AuthUserFile                             Define the file of user names.
Cache                                         Configure client and server side caching.
Chroot                                         Define the directory for a "chroot jail" in which Appweb will execute.
Compress                                     Control the use of compressed content.
Condition                                 Define a conditional test for a route.
DefaultLanguage                     Set the default language to use for a route.
Deny                                             Define which servers cannot access content.
DirectoryIndex                         Define the default index file to service for directory requests.
Documents                                 Directory containing web content.
EjsAlias                                     Define an Ejscript application alias.
EjsStartup                                 Define an Ejscript application script.
EjsWorkers                                 Define the maximum number of worker threads.
ErrorDocument                         Define an error document to serve.
ErrorLog                                     Define the location and format of the error log.
EspApp                                         Define an ESP application with required Routes.
EspCompile                                 Define the compilation command.
EspDb                                         ESP Database configuration.
EspDir                                         Set the directory for ESP MVC components.
EspEnv                                         Set an environment variable for ESP compilation commands.
EspKeepSource                         Control the preservation of intermediate source code.
EspLink                                     Define the link command.
EspLoad                                     Load an application.
EspResource                             Create routes for a resource.
EspResourceGroup                     Create route for a group of resources.
EspRoute                                     Create a new route for ESP controllers and pages.
EspRouteSet                             Define a package of routes for ESP.
EspShowErrors                         Show server side errors back to the client.
EspUpdate                                 Control whether updated ESP source code triggers reloading.
ExitTimeout                             Define the timeout period to wait for requests to complete before exiting or restarting.
Header                                         Define a HTTP header test for a route.
GroupAccount                             Define the O/S account group used by Appweb.
Home                                             Define the directory containing configuration files.
IgnoreEncodingErrors             Ignore UTF-8 encoding errors in WebSockets
IndexOptions                             Define the options for directory listings.
IndexOrder                                 Define the order of processing directory index options.
InactivityTimeout                 Maximum request and connection inactivity duration.
LimitBuffer                             Set the maximum buffer size for pipeline stages.
LimitCache                                 Set the maximum size of the Appweb cache for responses and sessions.
LimitCacheItem                         Set the maximum size of a single item in the Appweb cache.
LimitChunk                                 Set the maximum transfer chunk encoding size.
LimitClients                             Set the limit of simultaneous clients.
LimitFiles                                 Set the maximum number of open files or sockets on a Unix system.
LimitKeepAlive                         Define the re-use count for a connection.
LimitMemory                             Limit the total memory usage of Appweb. This is a hard limit.
LimitProcesses                         Maximum number of CGI processes to spawn.
LimitRequests                         Set the limit of simultaneous requests.
LimitRequestsPerClient         Set the limit of simultaneous requests for a single IP address.
LimitRequestBody                     Set the maximum size of the incoming request body.
LimitRequestForm                     Set the maximum size of the incoming request form data.
LimitRequestHeader                 Set the maximum total request header size.
LimitRequestHeaderLines     Set the maximum number of request header lines.
LimitResponseBody                 Set the maximum response body size.
LimitUpload                             Set the maximum file upload size.
LimitUri                                     Set the maximum size of a request URI.
LimitWebSocketsFrame             Limit the maximum size of a Web Sockets Message Frame.
LimitWebSocketsMessage         Limit the maximum size of a Web Sockets Message.
LimitWebSocketsPacket         Limit the maximum size of a Web Sockets Message Packet.
LimitWorkers                             Limit the maximum size of a Web Sockets Message.
Listen                                         Define the IP address and port on which to listen.
LoadModule                                 Load an Appweb module.
LoadModulePath                         Specify a list of directories to search for modules.
LogRoutes                                 Display the route table in the error log.
Log                                             Control the tracing of HTTP events.
MemoryPolicy                             Define the action to take when memory is depleted.
Methods                                     The acceptable HTTP method verbs.
NameVirtualHost                     Nominate an IP address for name-based virtual hosting.
Options                                     Control directory listing options.
Order                                         Specify the order in which the allow and deny directives apply.
Param                                         Define a route step to test request param values.
Prefix                                         Define a route prefix to trim from the URI.
Protocol                                     Define the HTTP protocol to use.
PutMethod                                 Control use of the HTTP PUT method.
Redirect                                     Redirect requests to a new target.
RequestParseTimeout             Maximum time to parse a request or response HTTP headers.
RequestTimeout                         Maximum request duration.
Require                                     Define which authenticated users will be permitted access to content.
ResetPipeline                         Reset the input and output pipeline for a block.
Route                                         Define a block of directives to apply to a URL route.
RouteName                                 Set the route name.
ScriptAlias                             Map a URL to a directory for CGI processing.
SetConnector                             Set the connector stage for a block.
SetHandler                                 Set the handler to process requests.
Source                                         Define source code for the handler to use.
StartWorkers                             Number of worker threads to pre-allocate and preserve.
Target                                         Define the target action to take for a route to serve a response to the client.
ThreadStack                             Stack size for each thread.
ServerName                                 Define a name for the server to use for itself.
SessionTimeout                         Maximum session state inactivity duration.
SSLCACertificateFile             Define the location of the client certificate file.
SSLCertificateFile                 Define the server certificate.
SSLCertificateKeyFile         Define the server's private key.
SSLCipherSuite                         Set the cipher suite to use for SSL.
SSLEngine                                 Enable SSL processing for a block.
SSLProtocol                             Set the SSL protocols to enable.
SSLVerifyClient                     Verify the identity of the client certificate.
SSLVerifyIssuer                     Verify the identity of the issuer or the client certificate.
Target                                         Define a route target.
TraceMethod                             Control whether the HTTP Trace method is enabled.
TypesConfig                             Specify the location of the MIME types file.
UnloadModule                             Unload an Appweb module.
Update                                         Define an update modification for a route.
UploadDir                                 Set the directory for uploaded files.
UploadAutoDelete                     Control if files are auto-deleted after uploading.
UserAcount                                 Define the O/S user account used by Appweb.
VirtualHost                             Create a directory block for virtual hosting for an IP address.

原创粉丝点击