0 votes
81 views
in General by
closed
81 views
closed

1 Answer

0 votes
by (578k points)
 
Best answer

Troubleshooting and Resolving HTTP Errors in cPanel Hosting

HTTP errors often point to server or permission issues. Below are common errors, their causes, and steps to resolve them in a cPanel-based hosting environment.


Error 403: Forbidden

Occurs when access to a resource is denied.

Common Causes:

  1. Incorrect file or folder permissions.
  2. Missing or misconfigured .htaccess file.
  3. Absence of an index file (e.g., index.html or index.php).
  4. IP restrictions or ModSecurity blocks.

Fixes:

  1. Check File and Folder Permissions:

    • Log in to cPanel and open the File Manager.
    • Ensure folder permissions are set to 755 and file permissions to 644.
    • Update permissions via cPanel or SSH:
      chmod 755 /path/to/folder chmod 644 /path/to/file 
  2. Verify .htaccess File:

    • Check for incorrect rules or restrictions.
    • Reset .htaccess to default:
      # Default cPanel .htaccess DirectoryIndex index.php index.html 
  3. Ensure an Index File Exists:

    • Confirm that index.php or index.html is present in /public_html/.
  4. Check ModSecurity Logs:

    • Access ModSecurity in cPanel.
    • Temporarily disable it for the domain and test.
  5. IP Restrictions:

    • Check the IP Deny Manager in cPanel for blocked IPs.
    • Remove blocks if necessary.

Error 404: Not Found

Occurs when a requested resource doesn’t exist on the server.

Common Causes:

  1. Incorrect URLs or broken links.
  2. Missing files or directories.
  3. Rewrite rule issues in .htaccess.

Fixes:

  1. Check URL Accuracy:

    • Ensure the requested URL matches the file or folder name (case-sensitive).
  2. Restore Missing Files:

    • Use the File Manager or backup system (e.g., JetBackup) to restore missing files.
  3. Verify .htaccess Rewrite Rules:

    • Reset .htaccess for WordPress or other CMS:
      # WordPress default .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> 
  4. Enable Custom Error Pages:

    • Go to Error Pages in cPanel under the Advanced section.
    • Create a custom 404 page for user guidance.

Error 503: Service Unavailable

Occurs when the server is temporarily unable to handle requests.

Common Causes:

  1. Server overload or resource limits (CPU, memory).
  2. Misconfigured PHP or scripts.
  3. Apache/LiteSpeed server issues.

Fixes:

  1. Check Resource Usage:

    • Log in to cPanel and check Resource Usage under Metrics.
    • Optimize scripts if limits are exceeded.
  2. Restart Services (Requires Root Access):

    • For Apache or LiteSpeed:
      systemctl restart httpd # Apache systemctl restart lsws # LiteSpeed 
    • For PHP-FPM:
      systemctl restart php-fpm 
  3. Optimize Scripts:

    • Identify slow scripts or problematic plugins in your CMS (e.g., WordPress).
    • Temporarily disable plugins causing issues.
  4. Increase Server Limits:

    • Edit php.ini to increase limits:
      max_execution_time = 300 memory_limit = 256M 
    • Save changes and restart PHP.
  5. Check Logs for Details:

    • Access Errors under the Metrics section in cPanel.
    • Review server error logs for more information.

Best Practices for Resolving HTTP Errors

  1. Backup Before Making Changes:

    • Use tools like JetBackup to secure files and configurations.
  2. Enable Error Logging:

    • Use cPanel logs or enable logging via .htaccess:
      php_flag display_errors On php_value error_reporting E_ALL 
  3. Contact Hosting Support:

    • If issues persist, contact your hosting provider or server administrator for assistance.

By following these steps, you can effectively troubleshoot and resolve HTTP errors like 403, 404, and

Related questions

0 votes
1 answer 43 views
asked Nov 6, 2024 in General by Murima 43 views
0 votes
1 answer 77 views
asked Aug 28, 2024 in General by Zilper 77 views
0 votes
1 answer 48 views
0 votes
0 answers 165 views
0 votes
0 answers 48 views
0 votes
1 answer 61 views
0 votes
1 answer 90 views
0 votes
1 answer 80 views
Welcome to Nestict Research Q&A, where you can ask questions and receive answers from other members of the community.

Before you ask, search the website to make sure your question has not been answered. If you are ready to ask, provide a title about your question and a detailed description of your problem.

...