Apache server stops - apache

i dont know why; but my apache server is crashing about every hour since this morning .. to overcome the problem, i'm just restarting the apache via service restart httpd command on ssh.
there is no program using ram. when i write TOP comment on ssh, it says 220mb of 8gb ram is free. but niether mysql nor httpd or php etc is using any ram or cpu.
8gb total ram - 7939112 used - 225136 free
top usage:
mysql = 0.7% cpu, 9.3% mem
php = 0.7% cpu, 0.1% mem
httpd = 0.7% cpu, 0 mem
my system details: centos, cpanel, apache
what should i do? i also dont get any error email from cpanel.

Go to task manager to see which of the ones you have listed is taking the most memory. Also if you are using owncloud this is the biggest hoger of memory. Now if it is apache is you need to determine if it is one of the services you have running that is rendering most of the memory. But if it is not of the services and it is apache then you might have try reninstalling apache again. But before you uninstall apache disable mysql or any server type like mysql to see if that could be the issue, if so then there is service running hard that needs to be deleted or checked because is talking to something. Check your task manager and see what is taking the most memory and start from there.

Related

1 Server Multi cPanel, how the apache work?

i want to ask something about dedicated server.
i have dedicated server and a cPanel website with heavy load, when i check the server load, all parameter didn't go up to 60% usage. but the apache work is high.
so i wonder if i can do this.
i buy dedicated server(DS) and install 2 cPanel on same DS. i know that cPanel need an IP to bind the license so i add 1 additional IP to my DS.
what i am trying to archieve here is to split workload in same website, and to split the traffic i use loadbalancer from CF.
so i have abc.com with 2 different IPs and use LoadBalancer to split the load.
here is why i need to do this
Server load relative low (under 80%)
Apache load relative high 3-10 req/s
There is a problem in your problem definition
What do you mean by Apache work?
if you want have more threads and processes of Apache httpd on the same server, you dont need to install two Cpanel instances, you could tune your Apache httpd worker configuration for a better performance and resource utilization.
you can even use litespeed or nginx web servers on cpanel.

Redis Configuration settings are changing dynamically after couple of hours

I installed Redis Server on the cloud machine (Ubuntu 18.0) where it contains SSD.
In the configuration file, I changed the dir to /temp and the dbfilename to dump.rdb
I restarted the server and checked the runtime settings with CONFIG GET.
It is showing the values what I set in the redis.conf file.
After 6 Hours, I checked it again. The strange thing is, these values got changed dir=/var/spool/cron"
and dbfilename=root.
I am sure, nobody attacked my server and it is under our own VPN and not publicly accessible.
Now, I did one more test, I installed a Docker Container (Ubuntu 18.0) in that cloud instance (Same instance) and did the test in the container. There is no change in the configuration at runtime after couple of hours.
Also, suspect if the cloud machine is built with magnetic HDD redis seems working fine. If I built with SSD then redis not working after couple of hours.
Can anybody help in this regard.
Thanks
I had a similar situation on the my Redis server.
If your Redis server is accessible from the public network, It might be an attack.
In my case, I changed the default port of Redis servers and add password protection.
After that, the same situation does not happen.
Check the below issue in Redis GitHub, You can get more information about your case.
https://github.com/redis/redis/issues/3594

Understanding Apache Traffic

I run a 2GB RAM Linode (Ubuntu) that hosts a few WordPress websites. Recently my server has been OOMing and crashing and I have been up all night trying to find out what's causing it. I have discovered there I get an enormous influx of traffic (a tiny DoS) that brings the whole thing down.
I have access logs setup across all of the virtual hosts and I am using tcptrack to monitor activity on the server.
The traffic appearing in my access logs does not account for the traffic I am seeing on tcptrack. i.e. there are a dozen i.p. addresses that are constantly opening and closing connections on the server, but are nowhere to be seen in the access logs for each virtual host.
Clearly it's because these i.ps are not hitting the virtual hosts, but I have tried to set up access logs to monitor server-wide traffic so that I can see what requests their making but I'm really struggling.
Can anyone please point me in the right direction, perhaps tcptrack is just too simplified to provide any meaningful insight?
Start using mod_security
https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#Installation_for_Apache
Debian has it which means Ubuntu likely does as well. You should also make sure the kernel is setup properly, search google for SYN_COOKIES. Look into iptables/shorewall etc. Shorewall is a package that wraps iptables. Iptables can be configured for detect floods and start dropping packets.

How to find the cause of multiple apache processes - Amazon EC2 Server

I run an Amazon EC2 panel through my Webmin control panel. Recently we have experienced problems with the server running out of memory and I have identified a rather alarming breakdown of running processes.
Could anyone help me with a tip on how to find the cause of this problem? Our server set up has been running perfectly for almost 6 months without going down.

How to make apache slow and unreliable?

I'm writing some code on a mobile device that uses a REST service to retrieve data from a host. That REST services is being proxied by Apache. In test mode I would like to be able to simulate network outages (as if the device has lost it's cell connection) to test the applications handling of intermittent failures. I also need to validate it's behavior with slow network connections.
I'm currently using Traffic Shaper XP to slow the network connection, but now I need something to make the Apache server send connection resets both randomly and on predefined sequences (to setup and repeat specific test scenarios).
I highly recommend https://github.com/Shopify/toxiproxy from Shopify:
Download https://github.com/Shopify/toxiproxy/releases the cli and server
Run the server:
./toxiproxy-server-linux-amd64
On the cli setup proxy to apache on another port e.g. 8080
./toxiproxy-cli create apache -l localhost:8080 -u localhost:80
Make connection slow and unreliable:
./toxiproxy-cli toxic add apache -t latency -a latency=3000
./toxiproxy-cli toxic add apache -t limit_data -a bytes=1000 --tox=0.01
here add 3 second of latency and stop after 1000 bytes for 1% of requests there are other options for bandwidth etc. You can add or remove these during use. Lots of other features and libraries there.
In Apache2 you can make it slow by adjust prefork settings in apache2.conf. The settings below ought to make apache pretty fn slow. They made my local web application take 700% longer to load.
<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 2
MaxSpareServers 2
MaxClients 4
MaxRequestsPerChild 0
</IfModule>
It looks like DummyNet is the closest thing, but it’s still not quite there. For repeatable testing it would be good to have some control over dropped packets and resets.
Write a little proxy that forwards TCP connections from your app to the apache server and that you can set up in your test to cut the connection after x number of bytes or milliseconds.
On a different (or on the same) computer use the commandline tool ab to get some load on the apache. More informations here.
Is this a Unix or Linux environment? nice it up to give it lower priority then run a high CPU usage task like listening to music, playing a movie, calculating pi, etc. The low priority for Apache should create problems similar to what you're looking for.