2.7.2. OpenLiteSpeed

Attention!

When using OpenLiteSpeed, it is not recommended to enable PageSpeed (see the OLS official documentation).

LiteSpeed is a web server developed by LiteSpeed Technologies, which is an alternative to the Apache web server and is compatible with its most common features, such as .htaccess and mod_rewrite. LiteSpeed is particularly interesting because it speeds up site performance by using specialized plugins for various CMS. These plugins provide integration with LiteSpeed Cache (LSCache).

There are two versions of it — the open source OpenLiteSpeed and the paid LiteSpeed Enterprise. On our hosting, the first version is used — OpenLiteSpeed, which has a number of differences from the paid version:

  • Changes to the .htaccess file are not tracked — changes made to it do not take effect immediately, but with some delay.
  • No ESI support — because of this, plugins for integration with LSCache will not work in all CMS (for example, they will not run in PrestaShop and Magento — plugins for these CMS require mandatory ESI support).

The LiteSpeed web server has certain features and differs from the Apache web server. That is why it does not support some Apache features, which you will have to give up in order to use it.

  • You can use PHP version 5.4 or higher.
  • There are several important nuances when working with the .htaccess file.
  • Unable to run scripts:
    • Python.
    • Perl.
    • CGI.
  • The LiteMage module is not supported.
  • Symlinks (symbolic links to other files or directories) are not supported. Attempting to open such a link will return the 403 code.
  • Directives are activated upon the first request to the site and then updated every 5 minutes (every 300 seconds). Because of this, changes do not take effect immediately and you need to wait for them to be applied.
  • Only theRewrite (except RewriteBase) and Option +SymLinksIfOwnerMatch directives work. All other directives are ignored.
  • In order for all Rewrite directives to be processed correctly by the LiteSpeed web server, they must be modified according to the instructions in the official documentation. For example, a directive for Apache that looks like this:
    RewriteRule ^example/(.*)$ another/example/$1 [L]

    In LiteSpeed, should look like this:

    RewriteRule ^/?example/(.*)$ another/example/$1 [L]

    Unlike Apache, LiteSpeed directives must clearly specify the specific directory from which or to which the redirect will be made. At the beginning of directories or file names, you must set / to specify the initial root position.

  • To configure directives that will only be used by the LiteSpeed web server, you can use the IfModule wrapper, for example:
    <IfModule LiteSpeed>
      RewriteCond %{REQUEST_URI} ^/example/$
      RewriteRule ^.*$ http://%{HTTP_HOST}/another/example/ [R=301,L]
    <IfModule>
  1. Check out the specifics of work of OpenLiteSpeed and make sure your site is compatible with them.
  2. Open the "Site settings" section.
  3. In the "Web server" field, select "OpenLiteSpeed" and save the changes:
  4. Wait approximately 10-15 minutes for the changes to take effect.
Content

    (6)

    Comments

    ingyaroslav
    Ще на рахунок файлу .htaccess для OpenCart 2.3 в мене спрацював ось такий дефолтний набір правил (замість MYDOMAIN.COM.UA потрібно прописати свій домен в нижньому регістрі):


    # 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
    # 2. In your opencart directory rename htaccess.txt to .htaccess.
    # For any support issues please visit: http://www.opencart.com

    Options
    +FollowSymlinks

    # Prevent Directoy listing
    Options -Indexes

    # Prevent Direct Access to files
    <FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
    Require all denied
    ## For apache 2.2 and older, replace "Require all denied" with these two lines :
    # Order deny,allow
    # Deny from all
    </FilesMatch>

    # SEO URL Settings
    RewriteEngine On
    # If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

    RewriteEngine On
    RewriteBase /
    RewriteRule ^/?sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
    RewriteRule ^/?googlebase.xml$ index.php?route=extension/feed/google_base [L]
    RewriteRule ^/?system/download/(.*) index.php?route=error/not_found [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
    RewriteRule ^/?([^/?]*) index.php?_route_=$1 [L,QSA]

    RewriteCond %{QUERY_STRING} ^/?route=product/manufacturer$
    RewriteRule ^/?(.*)$ https://MYDOMAIN.COM.UA/? [R=301,NC,L]