| SYSTEM INFORMATION | |
|---|---|
| OS type and version | Ubuntu 24.04 LTS |
| Webmin version | 2.303 |
| Virtualmin version | 7.8-2 |
| Webserver version | Apache 2.4.58 |
| Related packages | PHP 8.3, PHP-FPM 8.3, MariaDB 10.11 |
I’m currently dealing with an intermittent 502 Bad Gateway problem on one of the websites hosted through Virtualmin. The website loads normally most of the time, but occasionally a page request fails with a 502 response instead of returning the expected content. What makes this difficult to troubleshoot is that the failure is not consistent enough to reproduce on every request. I can refresh the same page several times and get a normal response, and then without making any change to the website, another request may suddenly return the gateway error. The problem seems more noticeable when the website is handling dynamic PHP requests rather than when simply serving static files, although I have not yet been able to establish exactly what triggers the failure. There are no obvious application-level errors displayed to the visitor, so from the browser it simply looks as though the web server temporarily cannot communicate with the backend responsible for processing the request. I am trying to determine whether this behavior is related to the way Virtualmin is configuring the website’s PHP environment and webserver communication, rather than being an issue within the website’s application code itself.
I have already checked the website configuration in Virtualmin and confirmed that the virtual server is active and that the domain resolves correctly to the server. The website can serve normal pages successfully, which makes me hesitant to treat this as a basic DNS or virtual-host configuration problem. I have also restarted the relevant web services during troubleshooting, and the website works again afterward, but the intermittent 502 behavior eventually returns. Because restarting services only appears to provide temporary relief, I do not want to keep using that as a workaround without understanding what is actually causing the backend request to fail. I am particularly interested in determining whether the PHP process handling the request is becoming unavailable for short periods, reaching a process or connection limit, or otherwise failing to respond within the time expected by the webserver. I have looked through the available logs but have not yet found one clear message that consistently appears at the same time as every 502 response. If there is a specific Virtualmin or Webmin log location that should be checked first for this type of intermittent gateway error, I would appreciate guidance on what entries or timestamps I should compare with the failed requests.
The issue is especially noticeable when the website performs operations that require PHP to process a request rather than simply returning a cached or static resource. For example, a visitor can sometimes open the website normally and navigate through several pages without any problem, but a subsequent dynamic request may fail and display the 502 error. After waiting briefly or refreshing the request, the same page can become available again without any change to the URL or application data. This makes me suspect that something in the server-side request chain is temporarily unavailable, but I am not sure whether the correct place to investigate is the webserver, PHP handler, or the limits configured for the virtual server. I have avoided making several unrelated configuration changes at once because I want to isolate the actual cause instead of accidentally masking the problem. I would like to know whether Virtualmin has recommended settings or diagnostic commands for checking the health and availability of the PHP backend associated with a particular virtual server. It would also be helpful to understand whether a 502 generated in this situation should normally leave a corresponding entry in the webserver error log, PHP log, or another system log, because correlating those records with the exact time of a failed browser request may reveal which component is terminating or refusing the connection.
Another thing I am trying to establish is whether the problem could be related to resource or process handling on the server. The website does not necessarily fail completely when the 502 occurs; instead, the error appears to affect individual requests and then the site can return to normal behavior. Because of that pattern, I am wondering whether the PHP handler could be temporarily exhausting an available worker, hitting a configured process limit, or taking longer than the webserver is willing to wait for a response. I have not changed the website code specifically to work around the issue because I want to first confirm whether the server environment is reporting a corresponding condition. I am also interested in whether Virtualmin’s per-domain PHP configuration can differ from the global PHP configuration in a way that would cause only one virtual server to experience this behavior. If there are commands or Virtualmin interface pages that can show the currently active PHP version, handler mode, process limits, timeout values, or other relevant settings for the affected domain, I would appreciate recommendations for what information should be collected. My main goal is to identify the component responsible for the failed request before changing server-wide settings that could potentially affect the other virtual servers hosted on the machine.
For troubleshooting purposes, I am trying to collect information from the exact moment a 502 response occurs rather than relying only on the fact that the page eventually works again. I can reproduce the issue occasionally by using the website normally and monitoring the requests, but because it is intermittent, I have not been able to create a simple sequence that causes it every time. I would therefore like to compare the webserver error log, PHP-related logs, and system information around the timestamp of a failed request. I am also interested in knowing whether Virtualmin or Webmin provides any built-in diagnostic information that can show whether the virtual server’s PHP service was available when the request failed. If there is a recommended way to distinguish a backend connection failure from a PHP timeout or resource exhaustion condition, that would help narrow the investigation considerably. I am including the current system information below because I understand that the exact Webmin, Virtualmin, webserver, operating-system, and PHP-related package versions can be important when diagnosing this type of issue. I would prefer to provide the relevant version information up front so that anyone familiar with a similar Virtualmin configuration can tell me whether there are known configuration considerations or compatibility issues I should investigate.
I would appreciate advice on the best way to diagnose this as a single request-handling problem from the Virtualmin side. In particular, I want to understand what evidence I should collect when the next 502 response occurs and which logs should be checked first to determine whether Apache is unable to communicate with PHP-FPM or whether PHP itself is failing to respond correctly. Since the same website can work normally immediately before and after the error, I am trying to avoid assuming that the application is responsible without confirming what the server reports at the exact time of failure. If there are specific Virtualmin settings, Apache directives, PHP-FPM configuration values, or diagnostic commands that are commonly relevant to intermittent 502 responses, I would be grateful for suggestions on which ones to inspect and what their expected values should look like. I am particularly interested in a troubleshooting approach that can identify the underlying cause without simply increasing every timeout or process limit as a workaround. Any guidance on how to correlate the browser’s 502 response with the Virtualmin/webserver/PHP logs and determine which component is actually responsible would help me get to the root of the problem and keep the website stable without making unnecessary changes to the rest of the server. Thanks!