EasyApache 4 killing and not restarting nginx site

TheFez

Member
Nov 15, 2018
5
1
3
Pittsburgh, PA
cPanel Access Level
Root Administrator
I have an inherited server running Apache on several IPs and nginx on 1 IP. EasyApache 4 is installed. Occasionally EA runs and updates Apache. The process seems to be that EA kills all processes running on port 80 regardless of whether the service is Apache or nginx. Once EA completes its updates, it restarts the Apache processes while nginx is left stopped.

Is there a way to tell EA to either 1) only kill port 80 processes by the daemon name so that only Apache is shut down or 2) to ignore processes bound to a particular IP address or 3) to restart nginx at the same time Apache is restarted?

Basically I need EA to play nicely with nginx or ignore the service and the IP it's bound to. I do have the nginx IP set as reserved in cPanel/WHM if that makes any difference.

Thanks in advance. I'm a cPanel/WHM/EasyApache noob and more familiar with configuration by conf files and command line. Unfortunately that is not an option for the server in question.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hello @TheFez,

Are you using a specific third-party plugin for Nginx or is this something you've manually configured on your own? If you've setup Nginx on your own, you could look at how other Nginx plugins handle the Apache ports to get a better idea of how to approach the issue. For example, the apache_change_port function on the following third-party Nginx plugin might help:

engintron/engintron

Thank you.
 

TheFez

Member
Nov 15, 2018
5
1
3
Pittsburgh, PA
cPanel Access Level
Root Administrator
I'm not using any plugins for nginx. It was installed through rpm via yum and nginx is managed outside the scope of cPanel. I'm looking to configure EasyApache to only kill processes running on port 80 for IP addresses assigned to Apache and to ignore IPs assigned to nginx. Or to only kill httpd and not nginx. Let EasyApache manage Apache and leave nginx alone.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hello @TheFez,

Keep in mind that using Nginx and Apache together is unsupported on cPanel & WHM. It generally requires the development of a multifaceted plugin (like the one referenced in my last response). That said, if you're looking for a simply fix, would changing the default ports utilized by Apache help? If so, you could configure Apache to run on different ports by adjusting the following options under the System tab in WHM >> Tweak Settings:

Apache non-SSL IP/port
Apache SSL port


Thank you.
 

TheFez

Member
Nov 15, 2018
5
1
3
Pittsburgh, PA
cPanel Access Level
Root Administrator
Sounds like this is not possible without changing Apache to use non-standard ports, which is obviously a no-go. I appreciate the assistance, but it is frustrating that EasyApache isn't a little more cognisant of not stomping on other services. Why it can't do a systemctl stop httpd rather than killing everything it finds on port 80 and 443 is ridiculous.

I'll go with writing a script in the postupcp that restarts nginx after EasyApache does its murderous rampage upon nginx.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hi @TheFez,

Is there a particular issue you'd face when configuring Apache to run on non-standard ports? The virtual hosts are configured automatically upon adjusting those options in WHM >> Tweak Settings.

EasyApache 4 is designed and tested to be used with Apache. We do have a couple of planned feature requests that would offer native support for Nginx:

Nginx proxied to Apache (not standalone Nginx)
Stand-alone nginx supported as an alternative to Apache

However, in the meantime, integrating Nginx directly through your YUM isn't recommended. Instead, you'd need to build out a custom EasyApache 4 RPM using the guidelines documented at:

Tutorial - Building Custom Packages For EasyApache 4

Or, have you thought about using a third-party Nginx plugin that's already designed to integrate with EA4? Another alternative is LiteSpeed, which also is designed to integrate directly with EasyApache 4.

Thank you.
 

TheFez

Member
Nov 15, 2018
5
1
3
Pittsburgh, PA
cPanel Access Level
Root Administrator
Hi @TheFez,
Is there a particular issue you'd face when configuring Apache to run on non-standard ports? The virtual hosts are configured automatically upon adjusting those options in WHM >> Tweak Settings.
Yes, I'm not looking to send users to www.notreallymysite.com:8088 or whatever. No one is going to type that in. Any existing links will be broken.
 
  • Like
Reactions: cPanelMichael

Anoop P Alias

Well-Known Member
Mar 31, 2015
103
16
18
Kochi,Kerala,India
cPanel Access Level
Root Administrator
You do not need to send customers to alternate ports. You can simply have nginx listen on 80/443 and have the one site you need directly served by nginx and other sites proxied to Apache.
 
Last edited by a moderator: