I have a headless Pi running Raspbian with no other peripherals than an ethernet cable attached. It hosts a simple webpage using Apache with some simple PHP that interfaces with MariaDB. I connect over SSH and don't have a monitor at hand. I have port forwarding set up so that I can visit the page or SSH remotely too.
Now, here is the problem: Sometimes the RPi becomes unavailable. When this happens, SSH throws a "connection reset" error and Apache returns the 403: Forbidden page. The only option to make it accessible again is by power cycling the device. This unavailability usually occurs after a few days or a week of normal operation, making it hard to debug. When I unplug the ethernet cable, I get a timeout instead of the connection reset / 403 page, which means the Pi is still doing something, and the problem is not with the network probably. I don't see any records in Apache's access.log or error.log of those connection attempts unfortunately.
I don't know how to explain to my behaviour or how to debug it, nor could I find someone with a similar problem. One possible explanation that comes to my mind is a memory leak, but I'm not sure how to verify that.
Does anyone know what might cause this behaviour and how I could fix or debug it? I have tried reading the logs but know to little to start what is relevant or not. If there's any logs you think would be useful to post, please leave a comment so I can add them.
Update: Apache's error.log and access.log. Site stopped working somewhere between 09-10 February l. I tried to connect and got the 403 at 16:27, power cycle / reset occured at 16:29 09/02/19 UTC. After that it started working again and at 16:35 I could see the page.
Update 2: From what I see in /var/log/syslog, it seems like the Pi rebooted itself around 20:46 09/02/19. Could it be possible the supply glitched and the Pi somehow booted wrongly?