Automatic OpenLiteSpeed ​​reload with DirectAdmin

In DirectAdmin, you can set OpenLiteSpeed ​​to reload automatically after .htaccess changes.

Automatic OpenLiteSpeed ​​reload with DirectAdmin

DirectAdmin Configuration File Automatic OpenLiteSpeed ​​reload with DirectAdmin
DirectAdmin Configuration File

To set up automatic OpenLiteSpeed reloads with DirectAdmin, follow these steps:

  1. Log in to your DirectAdmin server as root via SSH.
  2. Create a new file named /usr/local/directadmin/scripts/custom/autoreload.sh using your preferred text editor.
  3. Paste the following code into the file:
#!/bin/sh
/usr/local/lsws/bin/lswsctrl reload
  1. Save and close the file.
  2. Make the script executable by running the command:
chmod +x /usr/local/directadmin/scripts/custom/autoreload.sh
  1. Edit the DirectAdmin configuration file /usr/local/directadmin/conf/directadmin.conf. Find the following lines:
crontask_frequency=5
crontask_hours=
crontask_days=
  1. Change crontask_hours to 0.
  2. Change crontask_days to *.
  3. Add a new line below it, containing the following text:
cronjobkey10='*/5 * * * * root /usr/local/directadmin/scripts/custom/autoreload.sh >/dev/null 2>&1'
  1. Save and close the file.
  2. Restart DirectAdmin by running the command:
service directadmin restart

After completing these steps, OpenLiteSpeed will automatically reload every 5 minutes on your DirectAdmin server.

I hope this helps! Let me know if you have any questions or concerns.

Automatic OpenLiteSpeed ​​reload with DirectAdmin
Automatic OpenLiteSpeed ​​reload with DirectAdmin

Automatic OpenLiteSpeed ​​reload with DirectAdmin

Currently, OpenLiteSpeed ​​will read .htaccess at start time, so if some new .htaccess files are created or existing files have been modified, the changes will not take effect until OpenLiteSpeed ​​is started again. Please note that DirectAdmin offers customers the ability to reload OpenLiteSpeed ​​directly from the user level and do this automatically for any .htaccess files edited in File Manager. However, if you want to set up a cron job that will reload OpenLiteSpeed ​​every 3 minutes (for example) to check for any newer .htaccess files, you can create a cron job like this:

*/3 * * * * root if ! find /home/*/domains/*/*_html/ -maxdepth 2 -type f -newer /usr/local/lsws/cgid -name '.htaccess' -exec false {} +; then systemctl restart lsws; fi
Install Litespeed enterprise for DirectAdmin
Install Litespeed enterprise for DirectAdmin

You can add the above line to  /etc/cron.d/openlitespeed_htaccess_scan . It will scan .htaccess files in the public_html/private_html directories, with a maximum of 2 directory levels. The maximum level can be changed to 3 or more (even unlimited), but please note that it may slow down the scan.

Để lại một bình luận

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *