Skip to main content

err_connection_refused - NGINX

Answered

Comments

11 comments

  • Andrew
    Translate

    Why did you do that? in WHM do you have Nginx enabled/installed? Make sure it's disabled there then use EasyApache to recompile/reinstall Apache on the server.

    Andrew N. - cPanel Plesk VMWare Certified Professional
    Do you need immediate assistance? 20 minutes response time!* Open a ticket
    EmergencySupport - Professional Server Management and One-time Services

    0
  • dxb04

    I wanted to uninstall it through ssh . 

    I know there is Nginx options in WHM and i already installed it from there , but i want to know how to manage through ssh too . 

    In general , is there a specific way to do so using ssh commands ?

    what could be the steps to do so and what did i miss in my previous steps ? 

    Is it required to recompile/reinstall Apache on the server in both ways ( WHM and SSH ) ? 

    and will all settings be reset again after that ?!

     

    Currently i reinstalled Nginx through ssh and the website is working with no issues .

     

     

    0
  • William Del Piero cPanel Staff

    Hi,

     

    When uninstalling Nginx, Apache should normally be switched back from the offset ports (444/81) back to ports 80 and 443 so websites would continue to function. After removing nginx, can you run the following command to see if Apache is running?

     

    /scripts/restartsrv_httpd --status

     

    You can run the command without the --status flag to restart the service. If the service fails to restart, it should include useful output to troubleshoot the issue.

    0
  • dxb04

    Hi , 

    Thanks for your reply , 

    I just try to uninstall and run the command you share :

    /scripts/restartsrv_httpd --status

    This is the output :

    [root@server ~]# /scripts/restartsrv_httpd --status
    httpd (/usr/sbin/httpd -k start) is running as root with PID 461279 (systemd+/proc check method).
    [root@server ~]# /scripts/restartsrv_httpd
    Waiting for “httpd” to restart gracefully …waiting for “httpd” to initialize ………finished.

    Service Status
            httpd (/usr/sbin/httpd -k start) is running as root with PID 461279 (systemd+/proc check method).

    Startup Log
            Nov 27 01:19:50 *server* systemd[1]: Starting Apache web server managed by cPanel EasyApache...
            Nov 27 01:19:50 *server* systemd[1]: httpd.service: Can't open PID file /run/apache2/httpd.pid (yet?) after start: Operation not permitted
            Nov 27 01:19:50 *server* systemd[1]: Started Apache web server managed by cPanel EasyApache.

    Log Messages
            [Wed Nov 27 01:19:50.318705 2024] [mpm_prefork:notice] [pid 461279:tid 461279] AH00163: Apache/2.4.62 (cPanel) OpenSSL/3.2.2 mod_bwlimited/1.4 configured -- resuming normal operations
            [Wed Nov 27 01:19:50.291282 2024] [security2:notice] [pid 461276:tid 461276] ModSecurity for Apache/2.9.7 (http://www.modsecurity.org/) configured.

    httpd restarted successfully.

    And again , the same error show up again 

     

     

    0
  • cPRex Jurassic Moderator

    Just to confirm, after the success restart from that command, you are still not able to connect to the sites, correct?  Can you run this command to confirm that the service is listening on port 80?

    netstat -lpn | grep 80 | grep http

    Knowing the output from that command would help us determine what may be happening.

     

    0
  • dxb04

    Yes , that's right .

    I just tried the command without uninstalling nginx , but i didn't get any results . 

     

    0
  • cPRex Jurassic Moderator

    It's odd that *nothing* is listening on port 80, as the cPanel service is designed to listen on that port if Apache or Nginx isn't running.

    At this point it would be best to submit a ticket so the server can be examined as there could be multiple issues happening with this system.

    0
  • dxb04

    As i mentioned , i didn't remove nginx .

    Should i remove it and try to run the command ? 

    By the way , there is one website on the server which i am getting many alerts , i am not sure if it is related to nginx or not , it shows :

    Title : lfd on *server*: Excessive processes running under user *web*

    Time:          Thu Dec  5 16:15:36 2024 +0400
    Account:       *web*
    Process Count: 12 (Not killed)

    Process Information:

    User:*web* PID:3819349 PPID:3819345 Run Time:19(secs) Memory:62264(kb) RSS:40268(kb) exe:/usr/local/cpanel/libexec/cpanellogd cmd:cpanellogd - http logs for *web*
    User:*web* PID:3819372 PPID:3819371 Run Time:17(secs) Memory:16892(kb) RSS:6912(kb) exe:/usr/local/cpanel/3rdparty/webalizer/bin/english cmd:/usr/local/cpanel/3rdparty/webalizer/bin/english -N 10 -D /home/*web*/tmp/webalizer/dns_cache.db -R 250 -p -n *web*.co -o /home/*web*/tmp/webalizer /var/log/nginx/domains/*web*.co.bkup
    User:*web* PID:3819373 PPID:3819372 Run Time:17(secs) Memory:17104(kb) RSS:1884(kb) exe:/usr/local/cpanel/3rdparty/webalizer/bin/english cmd:/usr/local/cpanel/3rdparty/webalizer/bin/english -N 10 -D /home/*web*/tmp/webalizer/dns_cache.db -R 250 -p -n *web*.co -o /home/*web*/tmp/webalizer /var/log/nginx/domains/*web*.co.bkup
    User:*web* PID:3819374 PPID:3819372 Run Time:17(secs) Memory:17104(kb) RSS:2012(kb) exe:/usr/local/cpanel/3rdparty/webalizer/bin/english cmd:/usr/local/cpanel/3rdparty/webalizer/bin/english -N 10 -D /home/*web*/tmp/webalizer/dns_cache.db -R 250 -p -n *web*.co -o /home/*web*/tmp/webalizer /var/log/nginx/domains/*web*.co.bkup
    User:*web* PID:3819375 PPID:3819372 Run Time:17(secs) Memory:17104(kb) RSS:1884(kb) exe:/usr/local/cpanel/3rdparty/webalizer/bin/english cmd:/usr/local/cpanel/3rdparty/webalizer/bin/english -N 10 -D /home/*web*/tmp/webalizer/dns_cache.db -R 250 -p -n *web*.co -o /home/*web*/tmp/webalizer /var/log/nginx/domains/*web*.co.bkup
    User:*web* PID:3819376 PPID:3819372 Run Time:17(secs) Memory:17104(kb) RSS:2012(kb) exe:/usr/local/cpanel/3rdparty/webalizer/bin/english cmd:/usr/local/cpanel/3rdparty/webalizer/bin/english -N 10 -D /home/*web*/tmp/webalizer/dns_cache.db -R 250 -p -n *web*.co -o /home/*web*/tmp/webalizer /var/log/nginx/domains/*web*.co.bkup
    User:*web* PID:3819377 PPID:3819372 Run Time:17(secs) Memory:17104(kb) RSS:1884(kb) exe:/usr/local/cpanel/3rdparty/webalizer/bin/english cmd:/usr/local/cpanel/3rdparty/webalizer/bin/english -N 10 -D /home/*web*/tmp/webalizer/dns_cache.db -R 250 -p -n *web*.co -o /home/*web*/tmp/webalizer /var/log/nginx/domains/*web*.co.bkup
    User:*web* PID:3819378 PPID:3819372 Run Time:17(secs) Memory:17104(kb) RSS:2012(kb) exe:/usr/local/cpanel/3rdparty/webalizer/bin/english cmd:/usr/local/cpanel/3rdparty/webalizer/bin/english -N 10 -D /home/*web*/tmp/webalizer/dns_cache.db -R 250 -p -n *web*.co -o /home/*web*/tmp/webalizer /var/log/nginx/domains/*web*.co.bkup
    User:*web* PID:3819379 PPID:3819372 Run Time:17(secs) Memory:17104(kb) RSS:1756(kb) exe:/usr/local/cpanel/3rdparty/webalizer/bin/english cmd:/usr/local/cpanel/3rdparty/webalizer/bin/english -N 10 -D /home/*web*/tmp/webalizer/dns_cache.db -R 250 -p -n *web*.co -o /home/*web*/tmp/webalizer /var/log/nginx/domains/*web*.co.bkup
    User:*web* PID:3819380 PPID:3819372 Run Time:17(secs) Memory:17104(kb) RSS:2012(kb) exe:/usr/local/cpanel/3rdparty/webalizer/bin/english cmd:/usr/local/cpanel/3rdparty/webalizer/bin/english -N 10 -D /home/*web*/tmp/webalizer/dns_cache.db -R 250 -p -n *web*.co -o /home/*web*/tmp/webalizer /var/log/nginx/domains/*web*.co.bkup
    User:*web* PID:3819396 PPID:140217 Run Time:13(secs) Memory:395612(kb) RSS:109028(kb) exe:/opt/cpanel/ea-php81/root/usr/sbin/php-fpm cmd:php-fpm: pool *web*_co
    User:*web* PID:3819398 PPID:140217 Run Time:13(secs) Memory:293852(kb) RSS:76692(kb) exe:/opt/cpanel/ea-php81/root/usr/sbin/php-fpm cmd:php-fpm: pool *web*_co

    And other emails shows : 

    Title: lfd on *server *: Suspicious File Alert

    Time:   Thu Dec  5 12:40:28 2024 +0400
    File:   /tmp/systemd-private-8c564fb84051467db65fcfc015708f59-ea-php81-php-fpm.service-IH5Wic/tmp/python3.61
    Reason: Linux Binary
    Owner:  *web* (1007:1008)
    Action: No action taken

    And

    Title : lfd on *server* : Excessive resource usage: *web* (3600773 (Parent PID:3600773))

    Time:         Thu Dec  5 03:39:09 2024 +0400
    Account:      *web*
    Resource:     Process Time
    Exceeded:     3649 > 3600 (seconds)
    Executable:   /opt/cpanel/ea-php81/root/usr/bin/php-cgi
    Command Line: /opt/cpanel/ea-php81/root/usr/bin/php-cgi /tmp/phpbbmEn2DE phpbb
    PID:          3600773 (Parent PID:3600773)
    Killed:       No

    It looks like it is related to CSF , but it is abnormal status . 

     

    0
  • cPRex Jurassic Moderator

    cPanel doesn't manage or distribute CSF, so I can't advise on those messages.

    I would remove Nginx and get the system back into a default Apache state to see if you can get things working there.  Then we know we have a good base system where things are working as they should be.

    0
  • dxb04

    What is the command to remove Nginx , is it : 

    1 - yum erase ea-nginx

    2- yum uninstall ea-nginx

    Becuase when i try the first one it works but the second one it doesn't , and after i use the erase command i tried to run the command you sent , and again it didn't show any results 

    0
  • cPRex Jurassic Moderator

    At this point it would likely be better to use the WHM interface to ensure things are removed properly with all dependencies.  However, the "erase" command is what you would want on the command line:

    https://support.cpanel.net/hc/en-us/articles/1500010475601-How-to-uninstall-ea-nginx

    0

Please sign in to leave a comment.