Litespeed on Debian 11 – Amazon AWS
This example is with the FREE OpenLiteSpeed license (not LiteSpeed).
There are variations on these examples. This shows one domain with a paid SSL certificate.
OpenLitespeed on Debian 11 – Amazon AWS
EC2 Menu
EC2 Menu
Install Debian Packages
My examples use root login, rather than “sudo …….” commands.
In this example, do not install Apache 2 and the usual PHP packages. If you do, phpmyadmin will not work. We will only install lsphp packages with OpenLiteSpeed, and mariadb. We will not complicate things, so no use of memcached.
You may configure the website root directory anywhere. We will use /usr/local/lsws/domain.com in the example.
SSL certificates will go to /usr/local/lsws/conf/cert as three files – .crt, .key, and .pem will simply be the two bundled files.
You will run a small shell script to ensure the domain.com directory and WordPress files are owner: nobody, and group: nogroup.
Fixes to help when using the vi editor on Debian:
set -o vi export EXINIT='set noautoindent' [To allow vi editor to copy and paste with the mouse:] vi /etc/vim/vimrc.local let skip_defaults_vim = 1 if has('mouse') set mouse=r endif [save and exit]
Some Debian .bashrc things that I change: (replace \u@domain with your own string)
You can place the set -o vi and EXINT lines into .bashrc if you wish. This example is for when you type sudo su and use root access.
cd ~ vi .bashrc [uncomment: alias rm="rm -i", and uncomment mv command as well, which lets you still use rm -f but stops accidental removes.] [you can also put the set -o vi and export EXINIT into the same file] [save and exit, then log back in to enable the change] export PS1='[\u@domain: \w # '
Under the ~ directory, this is where you mkdir .aws and create the config file for using aws services.
For example,
cd ~ mkdir .aws chmod 2775 .aws vi config [default] region=ap-southeast-2 aws_access_key_id=AAAAAAAAAAAAAAAAAAA aws_secret_access_key=BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB --> a blank line --> a 2nd blank line [save and exit] [Use your IAM S3 access credentials for AAAAAA and BBBBBB above - see my article on setting up EC2 preliminaries] aws configure [Just press the Enter key for each prompt. Then test with a bucket you know, for instance, aws s3 ls s3://MYBUCKET/]
References
OpenLiteSpeed on Debian
phpmyadmin
If you wish to use Let’s Encrypt:
OpenLiteSpeed Certbot
NOTE: mariadb-server
apt-get install mariadb-server will fix the error of not installing it
These are the PDF downloads you need to configure a standard installation
Simply go through each entry to ensure you have the same, and replace domain.com with your own domain.
I forget which is first, creating the virtual host then the listener, or the other way around. You will know from the error messages.
I ended up putting phpmyadmin under /usr/local/lsws/phpmyadmin.
I have not been able to add multiple domains – I was able to install a second domain with Let’s Encrypt, but from that point on, the server would not accept the primary domain, even when deleting and re-configuring from scratch.
Virtual Hosts > Example (this is the default OLS gives you)
When you do Virtual Hosts domain.com you simply use the + button in the grey coloured bar to add the VH.
The Rewrite Rules:
RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://domain.au/$1 [R,L]
The Header Operations:
Notice that I put phpmyadmin under /usr/share/phpMyAdmin as I usually do with apache or httpd servers. You can put it elsewhere though.
The thing to remember is not to install php, but only lsphp.
Also, we cannot compile PHP from OLS (or the enterprise litespeed) unless we have more then 2GB memory. If we have 1GB and 1GB swap space, it will terminate the compilation.
Just check the SSL filenames are correct, e.g. crt, key, rather than assigning key to crt by mistake etc.
There will be some 2047M edits to make, some log entries, the rewrite and header entries, and use if index.php, index.html entries, and use of .htaccess etc.
Tidy up anything you left lying around, such as temporary use of port 8080 or various self-help files.