The LiteSpeed web server supports automatic directory indexing when an index file is not present in a directory. It uses an external script to generate the index page on the fly. This provides you with maximum flexibility when creating the look and feel of your auto index page. You can also customize your index page at a global level, or for each natively configured virtual host.
The default script paired with the installation package is a PHP script. However, you can create your own script using any language you like.
When you write your own script, just remember that the path to the directory you’re indexing is passed to the script in a CGI environment variable: “LS_AI_PATH”. In PHP, you can retrieve the value with the command $_SERVER[‘LS_AI_PATH’].
The script can be placed anywhere you like, but if you want to share it among all of your virtual hosts, just place it under the lsws/share/autoindex/ directory. A “General Context” GUI with the URI “/_autoindex/” and Location “$SERVER_ROOT/share/autoindex/” is automatically created by LSWS for every virtual host. The default PHP script, located at lsws/share /autoindex/default.php, has the same look and feel as Apache’s mod_autoindex.
Server -> General -> Index Files -> Auto Index : Set to “Yes”
Server -> General -> Index Files -> Auto Index URI: Set to “/_autoindex/myindex.php”
VHost -> General -> Index Files -> Auto Index : Set to “Yes” VHost -> General -> Index Files -> Auto Index URI: Set to the URI of your script.
You cannot customize the index file at the virtual host level if the virtual host is configured through an Apache configuration file. In that case, you can only apply a customized index file at the global level.