🌐

openlitespeed

4 notes  •  Web Hosting

Change Maximum Upload File Size in OpenLiteSpeed / LiteSpeed

How to increase the file upload limit for sites running on OpenLiteSpeed or LiteSpeed web servers.

Method 1 — Edit php.ini

# Find the active php.ini
/usr/local/lsws/lsphp81/bin/php --ini | grep "Loaded Configuration"

# Edit php.ini
nano /usr/local/lsws/lsphp81/etc/php/8.1/litespeed/php.ini

Update these values:

upload_max_filesize = 256M
post_max_size = 256M
memory_limit = 512M
max_execution_time = 300

Method 2 — Edit .user.ini (Per-site)

# Create or edit .user.ini in the web root
nano /home/example.com/public_html/.user.ini

# Add:
upload_max_filesize = 256M
post_max_size = 256M
memory_limit = 512M

Method 3 — Via OpenLiteSpeed Admin Console

  1. Login to OpenLiteSpeed Admin at https://server-ip:7080
  2. Go to Server Configuration → General
  3. Scroll to PHP section and set upload limits
  4. Click Save and perform a graceful restart

Restart OpenLiteSpeed

systemctl restart lsws

Verify

# Check with a phpinfo() page or:
/usr/local/lsws/lsphp81/bin/php -i | grep upload_max

Install OpenLiteSpeed Web Server on Ubuntu

How to install OpenLiteSpeed (the open-source LiteSpeed web server) on Ubuntu 20.04 / 22.04.

Step 1 — Add OpenLiteSpeed Repository

wget -O - https://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | sudo bash

Step 2 — Install OpenLiteSpeed

sudo apt-get update
sudo apt-get install -y openlitespeed

Step 3 — Install PHP

# Install PHP 8.1 with common extensions
sudo apt-get install -y lsphp81 lsphp81-common lsphp81-mysql lsphp81-curl   lsphp81-json lsphp81-opcache lsphp81-xml lsphp81-zip lsphp81-mbstring

Step 4 — Set Admin Password

sudo /usr/local/lsws/admin/misc/admpass.sh

Step 5 — Start OpenLiteSpeed

sudo systemctl start lsws
sudo systemctl enable lsws
sudo systemctl status lsws

Step 6 — Open Firewall Ports

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 7080/tcp   # Admin console

Step 7 — Access Admin Console

Open https://your-server-ip:7080 in a browser and log in with the admin credentials set in Step 4.

Key Paths

/usr/local/lsws/               # OpenLiteSpeed install dir
/usr/local/lsws/conf/httpd_config.conf  # Main config
/usr/local/lsws/logs/error.log           # Error log
/usr/local/lsws/Example/html/           # Default web root

Configure Let's Encrypt SSL in OpenLiteSpeed

How to obtain and install a free Let's Encrypt SSL certificate for a site running on OpenLiteSpeed.

Prerequisites

  • A domain pointing to the server
  • OpenLiteSpeed running on port 80
  • Certbot installed

Step 1 — Install Certbot

sudo apt-get install -y certbot

Step 2 — Obtain the Certificate (Webroot Method)

sudo certbot certonly --webroot   -w /usr/local/lsws/Example/html/   -d example.com -d www.example.com   --email admin@example.com   --agree-tos

Step 3 — Configure SSL in OpenLiteSpeed Admin

  1. Log into the admin panel at https://server-ip:7080
  2. Go to Virtual Hosts → example.com → SSL
  3. Set the certificate paths:
    • Private Key File: /etc/letsencrypt/live/example.com/privkey.pem
    • Certificate File: /etc/letsencrypt/live/example.com/fullchain.pem
  4. Save and perform a graceful restart

Step 4 — Set Up Auto-Renewal

# Certbot renewal hook to restart OLS after renewal
cat > /etc/letsencrypt/renewal-hooks/post/restart-ols.sh << 'EOF'
#!/bin/bash
systemctl restart lsws
EOF
chmod +x /etc/letsencrypt/renewal-hooks/post/restart-ols.sh

# Test renewal
sudo certbot renew --dry-run

Verify

curl -I https://example.com
openssl s_client -connect example.com:443 -brief

OpenLiteSpeed Command Reference

Essential commands for managing the OpenLiteSpeed web server.

Service Management

# Start / stop / restart
systemctl start lsws
systemctl stop lsws
systemctl restart lsws

# Graceful restart (reload config without dropping connections)
systemctl reload lsws

# Check status
systemctl status lsws

# Enable on boot
systemctl enable lsws

CLI Management

# Start / stop via CLI
/usr/local/lsws/bin/lswsctrl start
/usr/local/lsws/bin/lswsctrl stop
/usr/local/lsws/bin/lswsctrl restart

# Check OpenLiteSpeed version
/usr/local/lsws/bin/openlitespeed -v

PHP Management

# List installed PHP versions
ls /usr/local/lsws/ | grep lsphp

# Use a specific PHP version
/usr/local/lsws/lsphp81/bin/php -v

# Check loaded php.ini
/usr/local/lsws/lsphp81/bin/php --ini

Log Files

/usr/local/lsws/logs/error.log     # Server error log
/usr/local/lsws/logs/access.log    # Server access log
/home/example.com/logs/            # Domain-specific logs

Config Files

/usr/local/lsws/conf/httpd_config.conf    # Main server config
/usr/local/lsws/conf/vhosts/              # Virtual host configs