App Server Context
Table of Contents
URI | Location | 二进制文件路径 | 应用类型 | 启动文件 | 运行模式 | Max Connections | Environment | 启用过期 | 默认过期 | 按类型过期 | 标头控制 | 索引文件 | 自动索引 | 域 | 认证名称 | Require(授权的用户/组) | 允许访问列表 | 拒绝访问列表 | Authorizer | 启用重写 | 重写继承 | 重写基准 | 重写规则 | 添加默认的字符集 | 自定义默认字符集 | 启用IP地理定位
App Server Context⇑
Description
An App Server Context provides an easy way to configure a Ruby Rack/Rails, WSGI, or Node.js application. To add a an application through an App Server Context, only mounting the URL and the application's root directory is required. There is no need to go through all the trouble to define an external application, add a 404 handler, and rewrite rules, etc.
URI⇑
Description
Specifies the URI for this context.
Syntax
指定此context下的URI。这个URI应该以"/"开始。 如果一个URI以"/"结束,那么该context将包含这个URI下的所有下级URI。如果context类型映射到系统目录上,则必须添加结尾的"/"
See Also
Location⇑
Description
指定此context在文件系统中的对应位置。
Default value: $DOC_ROOT + URI
Syntax
It can be an absolute path or path relative to $SERVER_ROOT, $VH_ROOT, or $DOC_ROOT. $DOC_ROOT is the default relative path, and can be omitted.
If the URI is a regular expression, then the matched sub-string can be used to form the "Root" string. The matched sub-string can be referenced with the values "$1" - "$9". "$0" and "&" can be used to reference the whole matched string. Additionally, a query string can be set by appending a "?" followed by the query string. Be careful. "&" should be escaped as "\&" in the query string.
例子
To simulate Apache's mod_userdir, set URI to exp: ^/~([A-Za-z0-9]+)(.*), set 位置 to /home/$1/public_html$2. With these settings, a request of URI /~john/foo/bar.html will map to file /home/john/public_html/foo/bar.html.
See Also
二进制文件路径⇑
Description
App Server的二进制文件的位置。
应用类型⇑
Description
用于此context的应用程序类型。 支持Rack/Rails, WSGI, 和 Node.js。
启动文件⇑
Description
用于启动应用程序的文件,路径应相对于应用程序根目录。
默认的启动文件包括Rack/Rails的'config.ru', WSGI的'wsgi.py'和'passenger_wsgi.py', NodeJS的'app.js'.
Syntax
Path relative to application root directory
运行模式⇑
Description
指定Rack/Rails的运行模式:"发展", "生产"或者是"预发布". 默认为 "生产".
Syntax
从列表中选择
Max Connections⇑
Description
Specifies the maximum number of concurrent connections that can be established between the server and an external application. This setting controls how many requests can be processed concurrently by an external application, however, the real limit also depends on the external application itself. Setting this value higher will not help if the external application is not fast enough or cannot scale to a large number of concurrent requests.
Syntax
整数
提示
Setting a high value does not directly translate to higher performance. Setting the limit to a value that will not overload the external application will provide the best performance/throughput.
Environment⇑
Description
Specifies extra environment variables for the external application.
Syntax
Key=value. Multiple variables can be separated by "ENTER"
启用过期⇑
Description
指定是否为静态文件生成Expires头。如果启用,将根据 默认过期和按类型过期生成Expires头。
这可以在服务器,虚拟主机和Context级别设置。低级别的设置将 覆盖高级别的设置。例如,Context级别的设置将覆盖虚拟主机级别的设置, 虚拟主机级别的设置将覆盖服务器级别的设置。
Syntax
从单选框选择
默认过期⇑
Description
指定生成Expires头的默认设置。该设置在启用过期 设为“启用”时有效。它可以被按类型过期覆盖。 除非必要,否则不要在服务器或虚拟主机级别设置该默认值。 因为它会为所有网页生成Expires头。大多数时候,应该是 为不常变动的某些目录在Context级别设置。如果没有默认设置,按类型过期中未指定的类型不会生成Expires头。
Syntax
A|Mseconds
文件将在基准时间(A|M)加指定秒数的时间后失效。 “A”代表基准时间为客户端的访问时间,“M”代表文件的最后修改时间。
按类型过期⇑
Description
为各个MIME类型分别指定Expires头设置。
Syntax
逗号分隔的“MIME-类型=A|M秒数”的列表。 文件将在基准时间(A|M)加指定秒数的时间后失效。
“A”代表基准时间为客户端的访问时间,“M”代表文件的最后修改时间。 MIME-类型可使用通配符“*”,如image/*。
标头控制⇑
Description
指定要添加的附加响应/请求头。可以添加每行一个来添加多个头指令。"NONE "可以用来禁止父头继承。如果没有提供,则假定为 "Header"。
Syntax
[Header]|RequestHeader [condition] set|append|merge|add|unset header [value] [early|env=[!]variable]
例子
append Cache-control no-store
Header set My-header cust_header_val
RequestHeader set My-req-header cust_req_header_val
提示
语法和用法类似于 Apache's mod_headers directives
The 'Header' directive is is optional and can be excluded or left in when copying rules from elsewhere without issue.
索引文件⇑
Description
指定URL映射到目录时顺序查找的索引文件名称。 您可以在服务器、虚拟主机和Context级别对其进行自定义。
Syntax
Comma-delimited list of index filenames.
提示
[性能建议] 只设置你需要的索引文件。
自动索引⇑
Description
在目录中,当索引文件中所列的索引文件不可用时,指定运行时是否即时生成目录索引。
此选项可以在虚拟主机级别和context级别中设置,并可以顺着目录树继承,直到被覆盖。 您可以自定义生成的索引页面。请访问在线百科了解如何操作。
Syntax
从单选框选择
提示
[安全建议] 建议关闭自动索引,从而尽可能防止泄露机密数据。
See Also
域⇑
Description
指定这个context下的realm授权。 当指定时,必须提供有效的用户和用户名来访问这个context。 Realms授权需要在虚拟主机安全部分进行设置。 此设置使用每个realm的域名称。
Syntax
从列表中选择
认证名称⇑
Description
为当前context下的realm认证指定一个替代的名称。 如果没有指定,原realm名称将被使用。 认证名称将显示在浏览器登陆弹出窗口。
Require(授权的用户/组)⇑
Description
指定哪些用户/用户组可以访问此context。 这里允许你使用一个用户/组数据库(在 域中指定)访问多个context, 但只允许该数据库下特定的用户/组访问这个context。
Syntax
Syntax is compatible with Apache's Require directive. For example:
- user username [username ...]
Only listed users can access this context. - group groupid [groupid ...]
Only users belonging to the listed groups can access this context.
允许访问列表⇑
Description
指定允许访问这个context下资源的IP地址或子网。综合 拒绝访问列表项的配置以及服务器/虚拟主机级别访问控制, 可访问性将以客户端IP所符合的最小范围来确定。
Syntax
Comma-delimited list of IPs/sub-networks.
例子
拒绝访问列表⇑
Description
指定哪个IP地址或子网不被允许访问这个context下的资源。 综合允许访问列表项的配置以及服务器/虚拟主机级别访问控制, 可访问性将以客户端IP所符合的最小范围来确定。
Syntax
Comma-delimited list of IPs/sub-networks.
例子
Authorizer⇑
Description
指定可用于生成授权/未授权 decisions的外部应用程序。 目前,仅FastCGI授权器可用。 有关FastCGI授权者角色的更多详细信息, 请访问http://www.fastcgi.com。
Syntax
从列表中选择
启用重写⇑
Description
指定是否启用LiteSpeed的URL重写. 可以在虚拟主机或context级别上自定义此选项, 并且沿目录树继承该选项,直到被其他选项覆。
Syntax
从单选框选择
重写继承⇑
Description
指定是否从父级context继承重写规则。 如果启用重写但不继承,将启用本context的重写基准及重写规则。
Syntax
从单选框选择
重写基准⇑
Description
指定重写规则的基准URL。
Syntax
URL
重写规则⇑
Description
指定虚拟主机级别的重写规则。
请勿在此处添加任何目录级重写规则。 如果您在.htaccess有任何目录级的重写规则,则应该使用uri"/"创建一个静态context, 并在那里添加重写规则。
重写规则由一个RewriteRule组成,并可可以在多个RewriteCond之后。
- 每行仅能有一条规则
- RewriteCond 和 RewriteRule 遵循Apache的rewrite语法。 只需从Apache配置文件中复制并粘贴重写规则即可。
- LiteSpeed和Apache mod_rewrite之间有细微差别:
- %\{LA-U:variable\} and %\{LA-F:variable\} 在Litespeed 重写中将被忽略
- Litespeed中加入了两个新变量: %\{CURRENT_URI\}表示正在处理的URL %\{SCRIPT_NAME\}表示为相应的CGI环境变量。
- Litespeed在遇到[L]后为了避免循环将停止处理此及此后的重写规则 而Apache mod_rewrite将仅停止处理该条重写规则。此行为类似于apachemod_rewrite中的[END]标志。
LiteSpeed的重写规则遵循Apache的重写规范。 有关重写规则的更多详细信息,请参阅 Apache's mod_rewrite document(英文文档) 和 Apache's URL rewriting guide(英文文档) .
Syntax
string
添加默认的字符集⇑
Description
S指定当内容类型是"text/html"或"text/plain"且没有参数时,是否添加字符集标记到"Content-Type"响应报头中。当设置为Off时,该功能禁用。当设置为On时,将添加自定义默认字符集中指定的字符集,如果没有指定,将添加默认的"iso-8859-1"字符集。
Syntax
从单选框选择
自定义默认字符集⇑
Description
指定一个字符集当添加默认的字符集是On时使用。这是可选的。默认值是iso-8859-1。当添加默认的字符集是Off时本设置将不生效。
Syntax
Name of a character set.
例子
启用IP地理定位⇑
Description
指定是否启用IP地理定位查找。 可以在服务器级别,虚拟主机级别,或context级别设置。
Syntax
从单选框选择