How to Fix the 403 Forbidden Error on LiteSpeed Web Server

Category : Litespeed


Encountering a 403 Forbidden error on your Litespeed web server can be a frustrating experience for both website owners and visitors. This error indicates that the server understood the request but refuses to fulfill it due to a lack of proper permissions. In this blog post, we’ll explore the common causes of the Litespeed 403 Forbidden error and provide step-by-step solutions to help you fix 403 forbidden error litespeed.

Understanding the Litespeed 403 Forbidden Error

A 403 Forbidden error occurs when the server denies access to a requested resource. This can happen for various reasons, such as incorrect file or directory permissions, misconfigured .htaccess files, missing or misconfigured PHP handlers, incorrect file ownership, restricted Litespeed WebAdmin access, disabled directory indexing, or overly strict security rules.

Common Causes and Solutions

1. File and Directory Permissions

One of the most common causes of a 403 error is incorrect file or directory permissions. To resolve this issue:

    1. Connect to your server using an FTP client or SSH.
    2. Navigate to your website’s root directory.
    3. Check the permissions of your files and folders. Files should typically be set to 644, while folders should be 755. You can use the following command to set the correct permissions:

For directories:

chmod 755 /path/to/directory

For files:

chmod 644 /path/to/file

2. File Ownership

Another common cause of 403 Forbidden errors is when the files and folders on the web server have the wrong owner.

For example, let’s say your website’s files are located in the /home/user/public_html directory. This directory and all the files inside it should be owned by the user account.

However, if some files were uploaded or created by a different user account, like nobody, it can lead to 403 errors. This often happens when:

  • Migrating files from another server where they had different owners
  • Uploading files via FTP using an account other than the main user
  • A script or application running as a different user creates new files

When Litespeed sees that the owner of a file doesn’t match the owner of the virtual host, it will deny access to prevent potential security issues.

To check the owner of files and folders, you can use the ls -l command. For example:


In the example above, most files are owned by the user account which is correct. However, uploadedfile.jpg is owned by nobody, which would cause a 403 error.


To fix ownership related 403 errors, you need to recursively change the owner of all files and folders to match the virtual host user.

  1. Connect to your server via SSH.
  2. Navigate to the root directory of your website, e.g.:
    cd /home/user/public_html
  3. Run the following command, replacing user with the correct account username:
    chown -R user:user .

    This will recursively (-R) change the owner and group of all files and subdirectories to user.

  4. Verify the owner has been updated with ls -l.
  5. Reload the webpage and the 403 error should be resolved.

Additionally, make sure any FTP accounts or scripts that create new files are running under the correct user account to prevent future issues.

If you have many websites on the server, you may need to repeat this process for each one, making sure to use the appropriate user account for each virtual host.

3. .htaccess File Configuration

Syntax errors or incorrect rules in your .htaccess file can also lead to a 403 error. To troubleshoot:

  1. Locate your .htaccess file in your website’s root directory.
  2. Open the file and carefully examine its contents for any syntax errors or incorrect rules, such as “deny from all” or “deny from <your ip address>”.
  3. If you find any issues, correct them and save the file.
  4. Consider creating a backup of the .htaccess file before making modifications.

4. Verify PHP Handlers

Incorrect or missing PHP handlers can also cause 403 Forbidden errors. PHP handlers are responsible for processing PHP scripts on the server. If the handler is not configured correctly, it may lead to access issues.

To verify and fix PHP handler issues:

  1. Log in to your Litespeed WebAdmin panel.
  2. Navigate to Configuration > Server > Script Handler.
  3. Check if the correct PHP handler is set up for your website. Common handlers include LSAPI, FastCGI, and suPHP.
  4. If the handler is missing or misconfigured, add or update it accordingly.
  5. Save the changes and restart Litespeed for the new configuration to take effect.

If you are using a control panel like cPanel or Plesk, you can manage PHP handlers through their respective interfaces:

  • In cPanel, go to Software > MultiPHP Manager to set the PHP version and handler for each website.
  • In Plesk, navigate to Websites & Domains > your_domain > PHP Settings to configure the PHP handler.

Make sure to choose a handler that is compatible with your PHP version and server setup. If you are unsure, consult your hosting provider or system administrator for guidance.

5. Litespeed WebAdmin Access Control

If you have restricted access to the Litespeed WebAdmin panel and forget to add your IP address or if your IP address changes, you may encounter a 403 Forbidden error when trying to access the WebAdmin.

To resolve this issue:

  1. Connect to your server via SSH.
  2. Open the Litespeed WebAdmin configuration file, usually located at /usr/local/lsws/admin/conf/admin_config.conf.
  3. Look for the <accessControl> section and add your IP address to the <allow> list. For example:
  4. Save the changes and restart Litespeed using the command: /usr/local/lsws/bin/lswsctrl restart.
  5. Try accessing the Litespeed WebAdmin panel again, and the 403 error should be resolved.

Note that you should only grant WebAdmin access to trusted IP addresses to maintain server security.

6. Directory Indexing

If directory indexing is disabled and there is no index file (e.g., index.php or index.html) in a directory, a 403 Forbidden error may occur when trying to access that directory.

To fix this issue, you can either enable directory indexing or create an index file in the directory.

To enable directory indexing:

  1. Open the Litespeed WebAdmin panel and navigate to the Virtual Host settings for the affected website.
  2. Go to the Directory Listing section and set the Enable option to Yes.
  3. Save the changes and restart Litespeed for the new settings to take effect.

Alternatively, you can create an index file in the directory:

  1. Connect to your server using an FTP client or SSH.
  2. Navigate to the directory that is causing the 403 error.
  3. Create a new file named index.php or index.html in that directory.
  4. Add some content to the file, such as a simple HTML page or a PHP script that displays a message.
  5. Save the file and reload the webpage. The 403 error should be resolved, and the index file will be displayed instead.

Keep in mind that enabling directory indexing can potentially expose the contents of a directory if no index file is present. It is generally recommended to have an index file in each directory and keep directory indexing disabled for security reasons.

7. Log File and Configuration File Locations

When troubleshooting 403 Forbidden errors, it can be helpful to review the Litespeed log files and configuration files. Here are the default locations for these files:

  • Error Log: /usr/local/lsws/logs/error.log
  • Access Log: /usr/local/lsws/logs/access.log
  • Main Configuration File: /usr/local/lsws/conf/httpd_config.conf
  • Virtual Host Configuration Files: /usr/local/lsws/conf/vhosts/your_domain/vhconf.conf

Note that these locations may vary depending on your specific Litespeed installation and server setup. You can also configure custom log file paths in the Litespeed WebAdmin panel under Configuration > Server > Log.

Review the error log for any messages related to the 403 error, as they may provide clues about the cause of the issue. The access log can help you identify the specific requests that are resulting in the 403 error.

The configuration files contain the server and virtual host settings. Check these files for any misconfigurations or incorrect directives that may be causing the 403 error.


Resolving the Litespeed 403 Forbidden error requires a systematic approach to identify the root cause. By checking file permissions, ownership, .htaccess configurations, PHP handlers, Litespeed WebAdmin access control, directory indexing, and reviewing log files, you can pinpoint and fix the issue.

If you’re still having trouble resolving the 403 error or need expert assistance, consider reaching out to your hosting provider or a professional server management service. They can help you diagnose and fix the issue quickly, ensuring your website is back up and running smoothly.