Configuration File
Browse / LiteSpeed Web Server Cheatsheet
LiteSpeed Web Server Cheatsheet
A comprehensive cheat sheet for LiteSpeed Web Server, covering essential configurations, commands, and features for efficient web hosting.
Core Configuration
Basic Settings
|
|
|
|
Document Root |
Specifies the base directory for website files. Configurable in the WebAdmin console or directly in |
|
Listening Ports |
Default ports are 80 (HTTP) and 443 (HTTPS). Modify in |
|
User and Group |
The user and group under which the server processes run. Defined in |
|
Server Name |
Configures the server’s hostname. Important for virtual hosting. |
|
Virtual Hosts |
Each virtual host defines a website. Configurations are stored in separate files or directly in |
Virtual Host Configuration
|
Virtual Host Root |
Base directory for the virtual host’s files. Configurable in the WebAdmin console. |
|
Domain Name |
The domain name associated with the virtual host. |
|
Access Logs |
Logs all incoming requests to the virtual host. Essential for debugging and analysis. |
|
Error Logs |
Logs any errors encountered while serving requests for the virtual host. |
|
Custom Log Formats |
Customize the format of access logs to include specific information. |
|
Contexts |
Define how specific URLs or file types are handled. Useful for PHP, static files, etc. |
Security
|
Enabling HTTPS Configure SSL certificates for secure communication. Use the WebAdmin console or manually configure in Example:
|
|
Access Control Limit access to specific directories or files using |
|
ModSecurity Integrate ModSecurity for enhanced security. Configure rules to protect against common web attacks. |
LSAPI and PHP
LSAPI Configuration
|
What is LSAPI? |
LiteSpeed API, a high-performance interface for running PHP applications. |
|
External App Settings |
Configure LSAPI applications in the WebAdmin console under ‘External App’. |
|
LSAPI Suffix |
Associate file extensions with the LSAPI application (e.g., |
|
PHP Handler |
Specify the PHP LSAPI handler in the virtual host configuration. |
|
Memory Limit |
Set memory limits for PHP processes to prevent excessive memory usage. |
|
Process Idle Timeout |
Configure how long idle PHP processes remain active. |
PHP Configuration
|
php.ini Location |
Usually located in |
|
Common PHP Settings |
|
|
Enabling Extensions |
Enable PHP extensions in |
|
Opcode Cache |
Use OPcache for improved PHP performance. Configure in |
|
Real-time process monitoring |
Use the |
|
Using custom .htaccess PHP settings |
You can configure PHP settings, for example, |
Troubleshooting PHP Issues
|
Check Error Logs Examine PHP error logs for any errors or warnings. Location: |
|
Restart LSAPI Restart the LSAPI process to apply configuration changes. Command: |
|
Verify PHP Version Ensure the correct PHP version is being used. Command: |
Caching and Optimization
LiteSpeed Cache (LSCache)
|
What is LSCache? |
A built-in caching solution for LiteSpeed Web Server, providing significant performance improvements. |
|
Enabling LSCache |
Enable LSCache in the WebAdmin console or through |
|
Cache Policies |
Define caching rules for different content types and URLs. |
|
Purging Cache |
Clear the cache to ensure the latest content is served. Use the WebAdmin console or command-line tools. |
|
ESI (Edge Side Includes) |
Use ESI to cache dynamic content fragments within static pages. |
|
Cache-Control Headers |
Leverage |
Gzip Compression
|
Enabling Gzip |
Enable Gzip compression to reduce the size of transmitted files. Configurable in the WebAdmin console or |
|
Compression Levels |
Adjust the compression level to balance CPU usage and file size reduction. |
|
MIME Types |
Specify the MIME types to compress (e.g., |
|
Verify Compression |
Use browser developer tools to verify that Gzip compression is enabled. |
|
Adjust Gzip settings |
You can adjust Gzip settings in the |
|
Disable Gzip for specific content types |
You can disable Gzip for specific content types, for example, images or videos. |
Static File Caching
|
Cache Static Files Configure LiteSpeed to cache static files (CSS, JavaScript, images) for improved performance. Configuration: |
|
Browser Caching Leverage browser caching by setting appropriate |
|
CDN Integration Integrate with a Content Delivery Network (CDN) to further optimize static file delivery. |
Command Line Tools and Management
Basic Commands
|
Start LiteSpeed |
|
|
Stop LiteSpeed |
|
|
Restart LiteSpeed |
|
|
Reload LiteSpeed |
|
|
Check Status |
|
|
Configuration Test |
|
Log Management
|
Access Logs |
Located in |
|
Error Logs |
Located in |
|
Debug Logs |
Enable debug logging for detailed troubleshooting. |
|
Log Rotation |
Configure log rotation to prevent logs from consuming excessive disk space. |
|
Analyze Logs |
You can use tools like |
|
Log Levels |
Configure log levels to control the verbosity of log messages. |
WebAdmin Console
|
Accessing the WebAdmin Console Access the WebAdmin console through a web browser. URL: |
|
Default Credentials Default username is |
|
Features Manage virtual hosts, configure server settings, monitor performance, and more through the WebAdmin console. |