How to Resolve 503 Error in Linux?

Posted on

Connectivity issues between Linux servers hosting your application can lead to a 503 Service Unavailable error. This article provides a guide to troubleshoot and temporarily resolve this error.

Step 1: Identify Application Type

First, determine if your website is a Node.js or Python-based application. If so, proceed with the relevant solutions below:

Node.js:

In cPanel, navigate to Node.js >> Open your application >> Access the source path via the terminal >> Run the application using: npm start or node app.js runserver & (The main file may vary, such as app.js, test.js, or others).

If you encounter a “port is already in use” error:
Use the command: netstat -nap | grep :port_number to identify the process using the port.
Use the command: lsof -p process_id (e.g. lsof -p 21069) to get more details about the process.

Terminate the process using the command: kill -9 process_id (e.g. kill -9 21069).

Restart your Node.js application and try running it again.

Additionally, check if the website is proxy-based and, if so, examine the proxy configuration.

Python:

In cPanel, navigate to the Python application section >> Open your application >> Access the source path via the terminal >> Run the application using: python3 manage.py runserver & or python manage.py runserver &.

Follow the same process as for Node.js to resolve port conflicts.

Step 2: Check Account Resources

Assess the resource usage of your account. High resource consumption indicates a need for optimization.

Step 3: Server Load

Evaluate the current load on the server. If high, take steps to reduce it.

Step 4: Enable Debug Mode

Enable debug mode for the website to uncover specific error messages:

  • For WordPress sites: Edit the WP_DEBUG value in wp-config.php from false to true.
  • For other sites: Activate debug logs in the PHP INI editor within cPanel.

This will help display the exact error on the site.

Step 5: Analyze Error Messages

The debug mode will show error messages. A common error is:

Error:

A memory exhaustion error message, such as:

“Allowed memory size of 41943040 bytes exhausted (tried to allocate 32768 bytes) in /home/mumbai/public_html/wp-content/plugins/userswp/vendor/ayecode/wp-super-duper/wp-super-duper.php on line 3060”

To resolve these errors, increase the memory limit in the MultiPHP INI Editor.

Step 6: Plugin/Theme Issues

If errors are plugin or theme related, scan for security weaknesses using tools like WP Toolkit. Identify the problematic plugin or theme.

Contact your web hosting tech team to disable the faulty plugin (without theme modifications) to see if it resolves the issue.

Step 7: Check PHP Versions

Try changing the site’s PHP version, prioritizing versions 5.6, 7.3, 8.0, and later.

By following these steps, you should be able to address the 503 error on Linux-based servers.

Leave a Reply

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