Install a lightweight WordPress container with OpenLiteSpeed Edge or Stable version based on Ubuntu 24.04 Linux.
Edit the .env file to update the demo site domain, default MySQL user, and password.
Feel free to check Docker hub Tag page if you want to update default openlitespeed and php versions.
Clone this repository or copy the files from this repository into a new folder:
git clone https://github.com/litespeedtech/ols-docker-env.gitOpen a terminal, cd to the folder in which docker compose.yml is saved, and run:
docker compose upNote: If you wish to run a single web server container, please see the usage method here.
The docker image installs the following packages on your system:
| Component | Version |
|---|---|
| Linux | Ubuntu 24.04 |
| OpenLiteSpeed | Latest version |
| MariaDB | Stable version: 11.4 |
| PHP | Latest version |
| LiteSpeed Cache | Latest from WordPress.org |
| ACME | Latest from ACME official |
| WordPress | Latest from WordPress |
| phpMyAdmin | Latest from dockerhub |
| Redis | Latest from dockerhub |
Cloned project
├── acme
├── bin
│ └── container
├── data
│ └── db
├── logs
│ ├── access.log
│ ├── error.log
│ ├── lsrestart.log
│ └── stderr.log
├── lsws
│ ├── admin-conf
│ └── conf
├── sites
│ └── localhost
├── LICENSE
├── README.md
└── docker-compose.yml-
acmecontains all applied certificates from Lets Encrypt -
bincontains multiple CLI scripts to allow you add or delete virtual hosts, install applications, upgrade, etc -
datastores the MySQL database -
logscontains all of the web server logs and virtual host access logs -
lswscontains all web server configuration files -
sitescontains the document roots (the WordPress application will install here)
Start the container with the up or start methods:
docker compose upYou can run with daemon mode, like so:
docker compose up -dThe container is now built and running.
docker compose stopTo stop and remove all containers, use the down command:
docker compose downWe strongly recommend you set your personal password right away.
bash bin/webadmin.sh my_passwordAfter running the following command, you should be able to access the WordPress installation with the configured domain. By default the domain is http://localhost.
bash bin/demosite.shbash bin/domain.sh [-A, --add] example.comPlease ignore SSL certificate warnings from the server. They happen if you haven't applied the certificate.
bash bin/domain.sh [-D, --del] example.comYou can either automatically generate the user, password, and database names, or specify them. Use the following to auto generate:
bash bin/database.sh [-D, --domain] example.comUse this command to specify your own names, substituting user_name, my_password, and database_name with your preferred values:
bash bin/database.sh [-D, --domain] example.com [-U, --user] USER_NAME [-P, --password] MY_PASS [-DB, --database] DATABASE_NAMETo preconfigure the wp-config file, run the database.sh script for your domain, before you use the following command to install WordPress:
bash bin/appinstall.sh [-A, --app] wordpress [-D, --domain] example.comGo to WordPress > LSCache Plugin > Cache > Object, select Redis method and input redis to the Host field.
We need to run the ACME installation command the first time only. With email notification:
bash bin/acme.sh [-I, --install] [-E, --email] EMAIL_ADDRUse the root domain in this command, and it will check for a certificate and automatically apply one with and without www:
bash bin/acme.sh [-D, --domain] example.comOther parameters:
-
[
-r,--renew]: Renew a specific domain with -D or --domain parameter if posibile. To force renew, use -f parameter. -
[
-R,--renew-all]: Renew all domains if possible. To force renew, use -f parameter. -
[
-f,-F,--force]: Force renew for a specific domain or all domains. -
[
-v,--revoke]: Revoke a domain. -
[
-V,--remove]: Remove a domain.
For local development domains (.test, .local, .dev, etc.), you can use mkcert to generate trusted SSL certificates without warnings.
First-time installation (Windows with Chocolatey):
bash bin/mkcert.sh --installThis will:
- Install
mkcertvia Chocolatey - Create and install a local Certificate Authority (CA) in your system trust store
After adding a domain to your environment, generate an SSL certificate:
bash bin/mkcert.sh [-D, --domain] example.testThis will:
- Check if the domain exists in your configuration
- Generate certificates for
example.testandwww.example.test - Create a
dockerLocaltemplate with SSL configuration - Copy certificates to the container
- Move the domain from the standard template to the SSL-enabled template
- Restart OpenLiteSpeed
Your domain will now be accessible via HTTPS with a trusted certificate at https://example.test
To remove the SSL certificate and revert to HTTP:
bash bin/mkcert.sh [-R, --remove] [-D, --domain] example.testThis will:
- Remove the domain from the
dockerLocaltemplate - Move it back to the standard
dockertemplate - Delete certificate files from both host and container
- Clean up empty templates if no other domains use SSL
- Restart OpenLiteSpeed
Important: You must add the domain to your environment first using
bash bin/domain.sh --add example.testbefore generating certificates.
To upgrade the web server to latest stable version, run the following:
bash bin/webadmin.sh [-U, --upgrade]Enable OWASP mod_secure on the web server:
bash bin/webadmin.sh [-M, --mod-secure] enableDisable OWASP mod_secure on the web server:
bash bin/webadmin.sh [-M, --mod-secure] disablePlease ignore ModSecurity warnings from the server. They happen if some of the rules are not supported by the server.
After installation, you can use phpMyAdmin to access the database by visiting http://127.0.0.1:8080 or https://127.0.0.1:8443. The default username is root, and the password is the same as the one you supplied in the .env file.
If you want to customize the image by adding some packages, e.g. lsphp83-pspell, just extend it with a Dockerfile.
-
We can create a
customfolder and acustom/Dockerfilefile under the main project. -
Add the following example code to
Dockerfileunder the custom folderFROM litespeedtech/openlitespeed:latest RUN apt-get update && apt-get install lsphp83-pspell -y -
Add
build: ./customline under the "image: litespeedtech" of docker-composefile. So it will looks like thislitespeed: image: litespeedtech/openlitespeed:${OLS_VERSION}-${PHP_VERSION} build: ./custom
-
Build and start it with command:
docker compose up --build
If you still have a question after using OpenLiteSpeed Docker, you have a few options.
- Join the GoLiteSpeed Slack community for real-time discussion
- Post to the OpenLiteSpeed Forums for community support
- Reporting any issue on Github ols-docker-env project
Pull requests are always welcome!