Virtual Host General

Table of Contents

General

Document Root | Administrator Email | Enable Compression | Enable GeoLocation Lookup

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

Web Socket Proxy

URI | Address

Document Root

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 Email

Description

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

Syntax

Comma separated list of email addresses

Enable Compression

Description

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

Syntax

Select from radio box

See Also

Enable Compression, Brotli Compression Level (Dynamic Content)

Enable GeoLocation Lookup

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,

Use Server's Log

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 Name

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

Place the log file on a separate disk.

Log Level

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

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)

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 Control

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 Name

Description

The access log filename.

Syntax

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

Tips

Put access log file on a separate disk.

Piped Logger

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 Apps 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 External App 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 Format

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 Headers

Description

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

Syntax

Select from checkbox

Tips

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

See Also

Log Format

Keep Days

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 Log

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

Put the log file on a separate disk.

Compress Archive

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 Files

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 Files

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

Only set index files that you need.

Auto Index

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

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

See Also

Index Files, Auto Index URI

Auto Index URI

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 Pages

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 Code

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

URL

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

Suffix

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.
Only specify the suffixes you really need.

Handler Type

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 Apps section.

Syntax

Select from drop down list

Handler Name

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 Access

Description

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

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

Allow Override

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 "Allow", "Deny", and "Order" are allowed. <Limit> and <LimitExcept> directives are also allowed with limited support for GET, HEAD, and POST requests.
  • When Auth is checked, directives "AuthGroupFile", "AuthName", "AuthType", "AuthUserFile", "Require", and "Satisfy" are allowed. <Limit> and <LimitExcept> directives are also allowed with limited support for GET, HEAD, and POST requests.
  • When FileInfo is checked, directives "AddDefaultCharset", "AddType", "DefaultType", "ForceType", "Redirect", "RedirectPermanent", "RedirectTemp", "RewriteBase", "RewriteCond", "RewriteEngine", "RewriteOptions", and "RewriteRule" are allowed.
  • When Indexes is checked, directives "DirectoryIndex", "ExpiresActive", "ExpiresByType", and "ExpiresDefault" are allowed.
  • When Options is checked, directive "Options" is allowed.

Allow Override configuration is available at the Server, Virtual Host, and Context levels. If a configuration is unchecked at the Server level, those controlled directives will be disabled for the entire server regardless of settings at lower levels. Lower levels can disable a setting that is enabled at a higher level, but cannot enable a setting that is disabled at an upper level.

Default values:
Server level: "None" (ignore access control file)
VH level: Inherit Server level setting
Context level Inherit VH level setting

Syntax

Select from checkbox

Tips

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

Access File Name

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 Expires

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 Default

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 Type

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 Configurations

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.

URI

Description

Specifies the URI(s) that will use this WebSocket backend. Traffic to this URI will only be forwarded to the WebSocket backend when it contains a WebSocket upgrade request.

Traffic without this upgrade request will automatically be forwarded to the Context that this URI belongs to. If no Context exists for this URI, LSWS will treat this traffic as though it is accessing a static context with the location $DOC_ROOT/URI.

Syntax

A plain URI (starting with "/"). If the URI ends with a "/", then this WebSocket backend will include all sub-URIs under this URI.

Example

Using the WebSocket proxy in conjunction with a Context allows you to serve different kinds of traffic in different ways on the same page, thus optimizing performance. You can send WebSocket traffic to the WebSocket backend, while setting up a static context so that LSWS can serve the page's static content, or an LSAPI context so LSWS will serve PHP content (both of which LSWS does more efficiently than the WebSocket backend).

Address

Description

A unique socket address used by the WebSocket backend. IPv4 sockets, IPv6 sockets, and Unix Domain Sockets (UDS) are supported. IPv4 and IPv6 sockets can be used for communication over the network. UDS can only be used when the WebSocket backend resides on the same machine as the server.

Syntax

IPv4 or IPV6 address:port or UDS://path

Example

127.0.0.1:5434
UDS://tmp/lshttpd/php.sock.

Tips

If the WebSocket backend runs on the same machine, UDS is preferred. If you have to use an IPv4 or IPv6 socket, set the IP address to localhost or 127.0.0.1, so the WebSocket backend is inaccessible from other machines.
Unix Domain Sockets generally provide higher performance than IPv4 or IPv6 sockets.