Bobcares

For every $500 you spend, we will provide you with a $500 credit on your account*

BLACK FRIDAY SPECIAL

*The maximum is $4000 in credits, Offer valid till December 6th, 2024, New Customers Only, Credit will be applied after purchase and expires after six (6) months

For every $500 you spend, we will provide you with a $500 credit on your account*

BLACK FRIDAY SPECIAL

*The maximum is $4000 in credits, Offer valid till December 6th, 2024, New Customers Only, Credit will be applied after purchase and expires after six (6) months

Enable auto index in openlitespeed

by | Jan 14, 2023

Wondering how to enable auto index in openlitespeed ? Our in-house experts are here to help you out with this article. Our litespeed support is here to offer a lending hand with your queries and issues.

How to enable auto index in openlitespeed?

Today, let us see the steps followed by support techs to enable autoindex in openlitespeed

By default, OpenLiteSpeed will have the Auto Index function disabled.

Auto Index can enable at the server level, vhost level & context level, and each sub-level will override a parent-level setting.

Enable/Disable Auto Index at the Server Level:

Server Configuration > General > Index Files 

Index Files: The default values are index.html and index.php separated by 

Auto Index: Set to Yes to enable Auto Index, and set to No or Not Set to disable Auto Index.

Auto Index URI: The script to generate the index, by default (when empty) will use /usr/local/lsws/share/autoindex/default.php

Enable/Disable Auto Index at the Vhost Level

Virtual Hosts > General > Index Files

Use Server Index Files: Set inherited index files named at the server level, or set the vhost’s own index file list. If set to Addition, it will add additional file names for index files to the server-level configuration.

Index Files: Default values are index.html and index.php separated by .

Auto Index: Set to Yes to enable Auto Index, set to No to disable it, or set to Not Set to inherit the server-level setting.

Auto Index URI: The script to generate the index, by default (when empty) will use /usr/local/lsws/share/autoindex/default.php

These options will override the server-level configuration.

Enable/Disable Auto Index at the Context Level

If you want to disable Auto Index for all except for one or a few specific directories, you can achieve this with context settings.

Virtual Hosts > Context > +

Create a Static Context, and choose a URL. In this example, we will use /test/

URI/test/ (do not miss the / at end)

Location$DOC_ROOT/test/.  This can be an absolute path e.g. /home/domain.com/public_html/test/ or a relative path with $DOC_ROOT or $VH_ROOT e.g $DOC_ROOT/test/ or $VH_ROOT/public_html/test/.

AccessibleYes

Index Files: Set the index file name for this context.

Auto Index: Enable, disable, or inherit Auto Index for this context.

How to Customize the Auto Index Page

This is the default Auto Index page:

The script used for Auto Index is /usr/local/lsws/share/autoindex/default.php. You can create your own script or edit the default one to further customize it.

For example, the following PHP code lists the files in the directory:

<?php
$list = scandir(getenv('LS_AI_PATH'));
echo "Directory to be indexed: " .getenv('LS_AI_PATH'). "<br>";
print_r($list);

The environment variable LS_AI_PATH is used to pass the directory that needs to be indexed to the script

[Looking for a solution to another query? We’re happy to help.]

Conclusion

In this article, we provide a quick and simple solution from our Support team to enable auto index in openlitespeed

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.