LiteSpeed Web Server Users' Manual

Version 5.1 Rev. 4

Virtual Host General

Table of Contents

General

Document Root | Administrator Email | Enable GZIP | Enable IP Geolocation | SPDY Advertisement | 

Virtual Host Log

Use Server's Log | File Name | Log Level | Rolling Size (bytes) | 

Access Log

Log Control | File Name | Piped Logger | Log Format | Log Headers | Rolling Size (bytes) | Keep Days | Bytes Log | Compress Archive | 

Index Files

Use Server Index Files | Index Files | Auto Index | Auto Index URI | 

Customized Error Pages

Error Code | URL | 

Script Handler Definition

Suffix | Handler Type | Handler Name | 

HT Access

Allow Override | Access File Name | 

Expire Settings

Enable Expires | Expires Default | Expires By Type | 

Apache Style Configuration

Apache Style Configurations | 

Document RootGo to top

Description

Specifies the document root for this virtual host. $VH_ROOT/html is recommended. This directory is referred to as $DOC_ROOT in contexts.

Syntax

A path which can be absolute, relative to $SERVER_ROOT, or relative to $VH_ROOT.

Administrator EmailGo to top

Description

Specifies email address(es) of the administrator(s) of this virtual host.

Syntax

Comma separated list of email addresses

Enable GZIPGo to top

Description

Specifies whether to enable GZIP compression for this virtual host. This setting is only effective when GZIP compression is enabled at the server level. Compression settings are configured at the server level (Tuning > GZIP).

Syntax

Select from radio box

See Also

Enable Compression, Compression Level (Static Content), Enable Dynamic Compression, Compression Level (Dynamic Content)

Enable IP GeolocationGo to top

Description

Enterprise Edition Only Specifies whether to enable/disable IP Geolocation lookup. Can be set at server, virtual host, or context level. IP Geolocation is disabled by default when using value "Not Set".

Syntax

Select from radio box

See Also

Use Client IP in Header, DB File Path, DB Cache Type

SPDY AdvertisementGo to top

Description

Specifies whether to advertise to clients that SPDY protocol is available. If set, LSWS will send an Alternate-Protocol response header when a client accesses SPDY-enabled websites through an HTTP connection. This requires the website to have both HTTP and HTTPS connections set up, and SPDY support enabled.

Syntax

port:protocol string

Example

If SPDY/3 is enabled on port 443, you can set the string to "443:npn-spdy/3"

Use Server's LogGo to top

Description

Specifies whether to put log messages from this virtual host into the server log file instead of creating its own log file.

Syntax

Select from radio box

File NameGo to top

Description

Specifies the path for the log file.

Syntax

Filename which can be an absolute path or a relative path to $SERVER_ROOT, $VH_ROOT.

Tips

[Performance] Place the log file on a separate disk.

Log LevelGo to top

Description

Specifies the level of logging. Available levels (from high to low) are ERROR, WARNING, NOTICE, INFO, and DEBUG. Only messages with a level higher than or equal to the current setting will be logged. If you want to set it to DEBUG, you must set the server log level to DEBUG as well. The level of debugging is controlled solely at the server level by Debug Level.

Syntax

Select from drop down list

Tips

[Performance] Unless Debug Level is set to a level other than NONE, DEBUG log level does not have any performance impact and is recommended.

See Also

Debug Level

Rolling Size (bytes)Go to top

Description

Specifies when the current log file needs to be rolled over, also known as log rotation. When the file size is over the rollover limit, the active log file will be renamed to log_name.mm_dd_yyyy(.sequence) in the same directory and a new active log file will be created. The actual size of the rotated log file once it is created will sometimes be a little bigger than this size limit. Set to 0 to disable log rotation.

Syntax

Integer number

Tips

Append "K", "M", "G" to the number for kilo-, mega- and giga- bytes.

Log ControlGo to top

Description

Where the access log should be written. There are three options:

  1. Write to the server's access log
  2. Create an access log for this virtual host
  3. Disable access logging

Syntax

Select from drop down list

File NameGo to top

Description

The access log filename.

Syntax

Filename which can be an absolute path or a relative path to $SERVER_ROOT, $VH_ROOT.

Tips

[Performance] Put access log file on a separate disk.

Piped LoggerGo to top

Description

Specifies the external application that will receive the access log data sent by LiteSpeed through a pipe on its STDIN stream (file handle is 0). When this field is specified, the access log will be sent only to the logger application and not the access log file specified in previous entry.

The logger application must be defined in External Application section first. Server-level access logging can only use an external logger application defined at the server level. Virtual host-level access logging can only use a logger application defined at the virtual host level.

The logger process is spawned in the same way as other external (CGI/FastCGI/LSAPI) processes. This means it will execute as the user ID specified in the virtual host's ExtApp Set UID Mode settings and will never run on behalf of a privileged user.

LiteSpeed web server performs simple load balancing among multiple logger applications if more than one instance of a logger application is configured. LiteSpeed server always attempts to keep the number of logger applications as low as possible. Only when one logger application fails to process access log entries in time will the server attempt to spawn another instance of the logger application.

If a logger crashes, the web server will start another instance but the log data in the stream buffer will be lost. It is possible to lose log data if external loggers cannot keep up with the speed and volume of the log stream.

Syntax

Select from drop down list

Log FormatGo to top

Description

Enterprise Edition Only Specifies the log format for the access log. When log format is set, it will override the Log Headers setting.

Syntax

String. The syntax of log format is compatible with Apache 2.0's custom log format.

Example


Common Log Format (CLF)
"%h %l %u %t \"%r\" %>s %b"

Common Log Format with Virtual Host
"%v %h %l %u %t \"%r\" %>s %b"

NCSA extended/combined log format
"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"

Log cookie value of Foobar
"%{Foobar}C"

See Also

Log Headers

Log HeadersGo to top

Description

Specifies whether to log HTTP request headers: Referer, UserAgent, and Host.

Syntax

Select from checkbox

Tips

[Performance] Turn this off if you do not need these headers in the access log.

See Also

Log Format

Keep DaysGo to top

Description

Specifies how many days the access log file will be kept on disk. Only rotated log files older than the specified number of days will be deleted. The current log file will not be touched regardless how many days worth of data it contains. If you do not want to auto-delete stale and very old log files, set this to 0.

Syntax

Integer number

Bytes LogGo to top

Description

Specifies the path to the bandwidth bytes log file. When specified, a cPanel compatible bandwidth log will be created. This will log the total bytes transferred for a request including both the request and reply bodies.

Syntax

Filename which can be an absolute path or a relative path to $SERVER_ROOT.

Tips

[Performance] Put the log file on a separate disk.

Compress ArchiveGo to top

Description

Specifies whether to compress rotated log files in order to save disk space.

Syntax

Select from radio box

Tips

Log files are highly compressible and this is recommended to reduce disk usage for old logs.

Use Server Index FilesGo to top

Description

Specifies whether to use the server's index file settings. If set to Yes, only the server's settings will be used. If set to No, the server's settings will not be used. If set to Addition, additional index files can be added to server's index file list for this virtual host. If you want to disable index files for this virtual host, you can set the value to No and leave the index files field empty.

Syntax

Select from drop down list

Index FilesGo to top

Description

Specifies names of index files that will be searched sequentially when a URL is mapped to a directory. You can customize it at the server, virtual host, and context level.

Syntax

Comma-delimited list of index filenames.

Tips

[Performance] Only set index files that you need.

Auto IndexGo to top

Description

Specifies whether to generate a directory index on the fly when index files listed in Index Files are not available in a directory. This option is customizable at the virtual host and context level, and is inherited along the directory tree until it is explicitly overridden. You can customize the generated index page. Please check online wiki How-tos.

Syntax

Select from radio box

Tips

[Security] It is recommended to turn off Auto Index wherever possible to prevent revealing confidential data.

See Also

Index Files, Auto Index URI

Auto Index URIGo to top

Description

Specifies the URI that will be used to generate the index page when index files listed in Index Files are not available in a directory. LiteSpeed web server uses an external script to generate the index page providing the maximum customization flexibility. The default script produces an index page with same look as Apache's. To customize the generated index page, please read online wiki How-tos. The directory to be indexed is passed to the script via an environment variable "LS_AI_PATH".

Syntax

URI

See Also

Index Files, Auto Index

Customized Error PagesGo to top

Description

Whenever the server has a problem processing a request, the server will return an error code and an html page as an error message to the web client. Error codes are defined in the HTTP protocol (see RFC 2616). LiteSpeed web server has a built-in default error page for each error code, but a customized page can be configured for each error code as well. These error pages can be even further customized to be unique for each virtual host.

Error CodeGo to top

Description

Specifies the HTTP status code for the error page. Only the selected HTTP status code will have this customized error page.

Syntax

Select from drop down list

URLGo to top

Description

Specifies the URL of the customized error page. The server will forward the request to this URL when the corresponding HTTP status code has returned. If this URL refers to a non-existing resource, the built-in error page will be used. The URL can be a static file, a dynamically generated page, or a page on another web site (a URL starting with "http(s)://"). When referring to a page on another web site, the client will receive a redirect status code instead of the original status code.

Syntax

URL

SuffixGo to top

Description

Specifies the script file suffixes that will be handled by this script handler. Suffixes must be unique.

Syntax

Comma delimited list with period "." character prohibited.

Tips

The server will automatically add a special MIME type ("application/x-httpd-[suffix]") for the first suffix in the list. For example, MIME type "application/x-httpd-php53" will be added for suffix "php53". Suffixes after the first need to set up in the MIME Settings settings.
Though we list suffixes in this field, the script handlers use MIME types, not suffixes, to decide which scripts to handle. You can thus use the Apache configuration directives "AddType" and "ForceType" (which control file MIME types) in .htaccess files to change which script handler certain files will use. For example, with the directive AddType application/x-httpd-php53 .php in a properly placed .htaccess file, you can stipulate that php files in this directory have the MIME type "application/x-httpd-php53" and thus will be handled by the script handler that uses MIME type "application/x-httpd-php53" (suffix "php53"). This then allows you to assign different script handlers, not only for different file suffixes, but also based on the locations of files.
[Performance & Security] Only specify the suffixes you really need.

Handler TypeGo to top

Description

Specifies the type of external application that processes these script files. Available types are: CGI, FastCGI, Web Server, LSAPI app, Load balancer, or Servlet Engine. For FastCGI, Web Server and Servlet Engine, a Handler Name needs to be specified. This is an external application name as predefined in the External Application section.

Syntax

Select from drop down list

Handler NameGo to top

Description

Specifies the name of the external application that processes the script files when the handler type is FastCGI, Web Server, LSAPI, Load Balancer, or Servlet Engine.

Syntax

Select from drop down list

HT AccessGo to top

Description

The following directives are supported in a directory level access control file (.htaccess file).

  • Authentication
    • AuthType
    • AuthName
    • AuthUserFile
    • AuthGroupFile
    • Require
  • Access Control
    • Allow from
    • Deny from
    • Order
  • File Info
    • AddDefaultCharset
    • AddType
    • DefaultType
    • ExpiresActive
    • ExpiresDefault
    • ExpiresByType
    • ForceType
    • Redirect
    • RedirectTemp
    • RedirectPermanent
    • RewriteEngine
    • RewriteOptions
    • RewriteBase
    • RewriteCond
    • RewriteRule
    • Satisfy
  • Other
    • <Limit>
    • <LimitExcept>
    • DirectoryIndex
    • Options

Allow OverrideGo to top

Description

Specifies what directives in an access control file are allowed. An access control file can be placed in a directory to control the accessibility of files under that directory.

  • When nothing is checked, inherited default settings will be used.
  • When None is checked, access control files will be ignored.
  • When Limit is checked, directives "Order", "Allow from" and "Deny from" are allowed.
  • When Auth is checked, directives "AuthGroupFile", "AuthName", "AuthType", "AuthUserFile", and "Require" are allowed.
  • When FileInfo is checked, directives "Satisfy", AddDefaultCharset", "AddType", "DefaultType", "ForceType", "ExpiresActive", "ExpiresDefault", "ExpiresByType", "Redirect", "RedirectTemp", "RedirectPermanent", "RewriteEngine", "RewriteOptions", "RewriteBase", "RewriteCond" and "RewriteRule" are allowed
  • When Indexes is checked, directive "DirectoryIndex" is allowed
  • When Options is checked, directive "Options" is allowed

Allow Override configuration is available at three levels: server, virtual host and context. If a configuration is not checked at the server level, the controlled directives will be disabled for the whole server whether or not it is enabled at lower levels. If something is enabled at the server level, virtual hosts will inherit same settings by default. Similarly context level settings will be inherited from virtual host settings. Lower levels can disable a setting that is enabled at an upper level, but cannot enable a setting that is disabled at an upper level.

Syntax

Select from checkbox

Tips

[Performance] If there is no need for directory level configuration customization, check None.

Access File NameGo to top

Description

Specifies the name of access control files. These files will be used only if Allow Override is enabled. Default name is .htaccess. You can configure this at server level and virtual host level. Server level is the default setting, and you can override it at virtual host level.

Syntax

Filename starting with "."

See Also

Allow Override

Enable ExpiresGo to top

Description

Specifies whether to generate an Expires header for static files. If enabled, an Expires header will be generated based on Expires Default and Expires By Type.

This can be set at server, virtual host and context level. Lower level settings will override higher level ones, i.e. context settings will override virtual host settings and virtual host settings will override server settings.

Syntax

Select from radio box

Expires DefaultGo to top

Description

Specifies default settings for Expires header generation. This setting takes effect when Enable Expires is set to "Yes". It can be overridden by Expires By Type. Do not set this default at the server or virtual host level unless you have to, since it will generate Expires headers for all pages. Most of time this should be set at the context level for certain directories that do not change often. If there is no default setting, no Expires header will be generated for types not specified in Expires By Type.

Syntax

A|Mseconds
The file will expire after base time(A|M) plus specified seconds. Base time "A" sets the value to the client's access time and "M" to the file's last modified time.

Expires By TypeGo to top

Description

Specifies Expires header settings for individual MIME types.

Syntax

Comma delimited list of "MIME-type=A|Mseconds". The file will expire after base time (A|M) plus specified seconds.

Base time "A" sets the value to the client's access time and "M" to the file's last modified time. MIME-type accepts wildcard "*", like image/*.

Apache Style ConfigurationsGo to top

Description

Specifies Apache configuration directives (supported by LiteSpeed) that you want to use in LiteSpeed native configuration file. For example, to override the default PHP configurations (php.ini entries) the server will need four directives: "php_value", "php_flag", "php_admin_value" and "php_admin_flag".

Syntax

Same as Apache configuration file.