503 Service Unavailable error on a shop hosted on shared cPanel server, apache error log:
tail /usr/local/apache/logs/error_log
2022-04-29 11:04:21.728438 [T0] [31.32.33.34:49768-H3:3D8F707E6843B0DF-0#APVH_XXXXXX.com:443] Max retries has been reached, 503!
2022-04-29 11:04:21.728438 [NOTICE] [186810] [T0] [31.32.33.34:49768-H3:3D8F707E6843B0DF-0#APVH_XXXXXX.com:443] oops! 503 Service Unavailable
2022-04-29 11:04:21.728443 [NOTICE] [186810] [T0] [31.32.33.34:49768-H3:3D8F707E6843B0DF-0#APVH_XXXXXX.com:443] Content len: 0, Request line: ‘GET / HTTP/1.1’
2022-04-29 11:04:21.728448 [INFO] [186810] [T0] [31.32.33.34:49768-H3:3D8F707E6843B0DF-0#APVH_XXXXXX.com:443] abort request…, code: 4
2022-04-29 11:04:21.728499 [INFO] [186810] [T0] [31.32.33.34:49768-H3:3D8F707E6843B0DF-0#APVH_XXXXXX.com:443] File not found [/home/username/public_html/503.shtml]
In my case, the user is hitting these limits because both PHP suEXEC Max Conn and NPROC are set to 100 and user is hitting this number.
So to fix it, there are different options:
- Restart CageFS
- Set PHP suEXEC Max Conn limit lower than NPROC limits
- Disable PHP suEXEC completely
- Change PHP version or handler to something different than suEXEC
Restart CageFS
If you use Cloudlinux, the first thing to do is to disable CageFS for that user and test if the issue is still present. If not, enable CageFS again and re-test. In 2/3 cases, CageFS is the problem.
Change Suexec limits
Since I also use CloudLinux on this server, I also have to take into consideration the LVE limits and make sure that Suexec limits in LSWS are lower than EP and NPROC limits defined in Cloudlinux.
To change Limits, navigate to LiteSpeed WebAdmin Console at SERVER:7080
From the terminal set a new user/password by running the script:
/usr/local/lsws/admin/misc/admpass.sh
After logging in the LSWS WebAdmin Console navigate to Server > General > Using Apache Configuration File and set PHP suEXEC Max Conn to a number lower than NPROC:
In my case, NPROC is set to 200, so I will set 45 for suEXEC
Now just restart LSWS and the website should load as expected.
Disable PHP suEXEC
To disable PHP suEXEC server-wide navigate to WHM > LiteSpeed > LiteSpeed configuration
Select PHP suEXEC Quick Configuration
And disable it.
Change PHP version
From WHM > MultiPHP Manager > User Domain Settings find the domain and change the PHP version: