My Nextcloud stopping working but apache2 still working

My nextcloud and SSH connection stop working randomly and I have no idea what’s happening, please help me, thanks.

Can you give some more details?
You tell that Apache keeps running, What part of Nextcloud is not accessible?
What do you get as error in the logging?
SSH and Nextcloud are two completly different things. SSH stops working as you can’t connect?
Do you have something like fail2ban running?

My version of Ubuntu Server is 16.04.
My nextcloud website(complete) stops working when i stop the use the server, normally in 20 minutes the nextcloud stops working and i cant connect to SSH too.
The error log dont show anything about errors in apache2.
I don’t know what is fail2ban…

Fail2ban is an security tool. It controls banning external connections when the try to reach your server with false password attempts. Then that iP will be banned and there is no connection possible to the server.

Is also the network connection down at that moment? Did you test this with ping to ipaddress?

The network connection is normal, I’m using the server to test it yet, on the server all the services say it’s working normally, the ping keeps running normally, I already tested it in every way but for some reason it still continues to stop the SSH and Apache2 services As if after a while he decided to stop by himself.