Virtual Host General

Table of Contents

General

Document Root | Administrator Email | Enable GZIP Compression | Enable Brotli Compression | Enable GeoLocation Lookup | cgroups

Virtual Host Log

Use Server's Log | File Name | Log Level | Rolling Size (bytes) | Keep Days | Compress Archive

Access Log

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

Index Files

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

Customized Error Pages

Error Code | URL

Expires Settings

Enable Expires | Expires Default | Expires By Type

File Upload

Temporary File Path | Temporary File Permissions | Pass Upload Data by File Path

Script Handler Definition

Suffix | Handler Type | Handler Name

Expire Settings

Enable Expires | Expires Default | Expires By Type

php.ini Override

php.ini Override

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 GZIP Compression

Description

Specifies whether to enable GZIP compression for this virtual host. This setting is only effective when Enable GZIP Compression is set to Yes at the server level.

Syntax

Select from radio box

See Also

Enable GZIP Compression

Enable GeoLocation Lookup

Description

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,

cgroups

Description

Apply cgroup settings to this CGI process if supported by the current OS. At this time, RedHat/Centos Linux v7.5+ and Ubuntu 18.04+ are supported. The currently executing user will be used to determine which cgroup configuration to apply.

Setting this to Disabled at the Server level will disable this setting server-wide. In all other cases, the Server level setting can be overridden at the Virtual Host level.

Default values:
Server level: Off
VH level: Inherit Server level setting

Syntax

Select from drop down list

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.

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

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.

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

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

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.

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

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/*.

File Upload

Description

Provides additional security functionality when uploading files by using a Request Body Parser to parse files to a server local directory where they can be easily scanned for malicious intent by third party modules. Request Body Parser is used when Pass Upload Data by File Path is enabled or a module calls LSIAPI’s set_parse_req_body in the LSI_HKPT_HTTP_BEGIN level. API examples provided in source package.

See Also

Hook::HTTP_BEGIN Priority

Temporary File Path

Description

Temporary directory where files being uploaded to server will be stored while request body parser is working. Default value is /tmp/lshttpd/.

Syntax

Absolute path or path starting with $SERVER_ROOT (for Server and VHost levels) or $VH_ROOT (for VHost levels).

Temporary File Permissions

Description

Determines file permissions used for files stored in temporary directory. Server level setting is global, can be overridden at VHost level.

Syntax

3 digits octet number. Default value is 666.

Pass Upload Data by File Path

Description

Specify whether or not to pass upload file data by path. If enabled, file path along with some other information is sent to backend handler instead of file itself when uploading. This saves on CPU resources and file transfer time but requires some updates to backend to implement. If disabled, file content will be transferred to backend handler, request body is still parsed to files.

Syntax

Select from radio box

Tips

Enable this to speed up file upload processing if backward compatibility is not an issue.

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

php.ini Override

Description

Used to overwrite php.ini settings in the current context (Virtual Host level or Context level).

Supported directives are:
php_value
php_flag
php_admin_value
php_admin_flag

All other lines/directives will be ignored.

Syntax

Override syntax is similar to Apache, a newline separated list of directives and their values with each directive being prepended by php_value, php_flag, php_admin_value, or php_admin_flag appropriately.

Example

php_value include_path ".:/usr/local/lib/php"
php_admin_flag engine on
php_admin_value open_basedir "/home"