Author Topic: nginx/httpd problem (98)Address already in use, bind to :80/443 failed  (Read 13201 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Hello,

I get errors in nginx and httpd.

I used "fuser -k 80/tcp",
nginx worked, my web site is running but it keeps giving errors in the background.

How can i solve this?

nginx
Code: [Select]
nginx: [emerg] bind() to 78.47.239.123:80 failed (98: Address already in use)
nginx: [emerg] bind() to 78.47.239.123:443 failed (98: Address already in use)
nginx: [emerg] bind() to 78.47.239.123:80 failed (98: Address already in use)
nginx: [emerg] bind() to 78.47.239.123:443 failed (98: Address already in use)
nginx: [emerg] bind() to 78.47.239.123:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

httpd
Code: [Select]
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down

Netstat info
Code: [Select]
tcp        0      0 0.0.0.0:82              0.0.0.0:*               LISTEN      7209/varnishd       
tcp        0      0 78.47.239.123:443       0.0.0.0:*               LISTEN      10314/nginx: master
tcp        0      0 127.0.0.1:6082          0.0.0.0:*               LISTEN      7209/varnishd       
tcp        0      0 78.47.239.123:80        0.0.0.0:*               LISTEN      10314/nginx: master
tcp6       0      0 :::82                   :::*                    LISTEN      7209/varnishd       
tcp6       0      0 :::8181                 :::*                    LISTEN      10168/httpd         
tcp6       0      0 :::8443                 :::*                    LISTEN      10168/httpd         

System is up to date.
Web Servers: nginx-varnish-apache
Apache version: Apache/2.4.39

Offline
****
Apa he needs to listen on 8181, not 80
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Apa he needs to listen on 8181, not 80
Contents of File: /usr/local/apache/conf/httpd.conf
Code: [Select]
#Listen 12.34.56.78:80
Listen 8181

Offline
****
Make sure your vhosts aren't trying to bind to 80
Google Hangouts:  rcschaff82@gmail.com

Offline
****
systemctl stop nginx
Systemctl stop httpd
Killall httpd
Killall nginx
Systemctl start nginx
Systemctl start httpd

Post any errors
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Make sure your vhosts aren't trying to bind to 80
I checked and i couldn't find port 80.

systemctl stop nginx
Systemctl stop httpd
Killall httpd
Killall nginx
Systemctl start nginx
Systemctl start httpd

Post any errors
No change.
Nginx and httpd are already running.
When I write "nginx" or "httpd" in terminal, it gives errors. But as i said, nginx is also working.
What else could be a reason?

Offline
*****
can you provide the output :
Code: [Select]
yum list httpd

Offline
*
can you provide the output :
Code: [Select]
yum list httpd

Code: [Select]
[root@srv ~]# yum list httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.ratiokontakt.de
 * epel: mirrors.n-ix.net
 * extras: centosmirror.netcup.net
 * remi-safe: mirror.23media.com
 * updates: mirror.plustech.de
Installed Packages
httpd.x86_64                      2.4.6-93.el7.centos                      @base
[root@srv ~]#

Offline
*****
seems some other httpd version installed do this :
yum remove httpd* cwp-httpd -y
yum install cwp-httpd -y

after that rebuild webserver config.

Offline
*
seems some other httpd version installed do this :
yum remove httpd* cwp-httpd -y
yum install cwp-httpd -y

after that rebuild webserver config.
Code: [Select]
[root@srv ~]# yum remove httpd* cwp-httpd -y
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package cwp-httpd.x86_64 0:2.4.39-3 will be erased
---> Package httpd.x86_64 0:2.4.6-93.el7.centos will be erased
--> Processing Dependency: httpd-mmn = 20120211x8664 for package: php-7.3.17-1.el7.remi.x86_64
---> Package httpd-tools.x86_64 0:2.4.6-93.el7.centos will be erased
--> Running transaction check
---> Package php.x86_64 0:7.3.17-1.el7.remi will be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package          Arch        Version                    Repository        Size
================================================================================
Removing:
 cwp-httpd        x86_64      2.4.39-3                   @cwp              27 M
 httpd            x86_64      2.4.6-93.el7.centos        @base            9.4 M
 httpd-tools      x86_64      2.4.6-93.el7.centos        @base            168 k
Removing for dependencies:
 php              x86_64      7.3.17-1.el7.remi          @remi-php73       10 M

Transaction Summary
================================================================================
Remove  3 Packages (+1 Dependent package)

Installed size: 46 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : php-7.3.17-1.el7.remi.x86_64                                 1/4
  Erasing    : httpd-2.4.6-93.el7.centos.x86_64                             2/4
  Erasing    : httpd-tools-2.4.6-93.el7.centos.x86_64                       3/4
Failed to stop httpd.service: Unit httpd.service not loaded.
  Erasing    : cwp-httpd-2.4.39-3.x86_64                                    4/4
warning: /usr/local/apache/conf/httpd.conf saved as /usr/local/apache/conf/httpd.conf.rpmsave
  Verifying  : httpd-tools-2.4.6-93.el7.centos.x86_64                       1/4
  Verifying  : php-7.3.17-1.el7.remi.x86_64                                 2/4
  Verifying  : httpd-2.4.6-93.el7.centos.x86_64                             3/4
  Verifying  : cwp-httpd-2.4.39-3.x86_64                                    4/4

Removed:
  cwp-httpd.x86_64 0:2.4.39-3               httpd.x86_64 0:2.4.6-93.el7.centos
  httpd-tools.x86_64 0:2.4.6-93.el7.centos

Dependency Removed:
  php.x86_64 0:7.3.17-1.el7.remi

Complete!
[root@srv ~]#

Code: [Select]
[root@srv ~]# yum install cwp-httpd -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                     |  33 kB     00:00
 * base: mirror.ratiokontakt.de
 * epel: mirrors.n-ix.net
 * extras: centosmirror.netcup.net
 * remi-safe: mirror.23media.com
 * updates: mirror.plustech.de
base                                                     | 3.6 kB     00:00
cwp                                                      | 2.9 kB     00:00
extras                                                   | 2.9 kB     00:00
mariadb                                                  | 2.9 kB     00:00
remi-safe                                                | 3.0 kB     00:00
updates                                                  | 2.9 kB     00:00
varnishcache_varnish5/x86_64/signature                   |  836 B     00:00
varnishcache_varnish5/x86_64/signature                   | 1.0 kB     00:00 !!!
varnishcache_varnish5-source/signature                   |  836 B     00:00
varnishcache_varnish5-source/signature                   | 1.0 kB     00:00 !!!
Resolving Dependencies
--> Running transaction check
---> Package cwp-httpd.x86_64 0:2.4.39-3 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch             Version               Repository     Size
================================================================================
Installing:
 cwp-httpd           x86_64           2.4.39-3              cwp           5.5 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 5.5 M
Installed size: 27 M
Downloading packages:
cwp-httpd-2.4.39-3.x86_64.rpm                              | 5.5 MB   00:03
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Failed to stop httpd.service: Unit httpd.service not loaded.
  Installing : cwp-httpd-2.4.39-3.x86_64                                    1/1
  Verifying  : cwp-httpd-2.4.39-3.x86_64                                    1/1

Installed:
  cwp-httpd.x86_64 0:2.4.39-3

Complete!

I did "Save & Rebuild Configuration" from Select Webservers.

and I checked with "yum list httpd" but showing "v2.4.6" again.
Code: [Select]
[root@srv ~]# yum list httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.ratiokontakt.de
 * epel: mirrors.n-ix.net
 * extras: centosmirror.netcup.net
 * remi-safe: mirror.23media.com
 * updates: mirror.plustech.de
Available Packages
httpd.x86_64                      2.4.6-93.el7.centos                       base
[root@srv ~]#

Offline
*
seems some other httpd version installed do this :
yum remove httpd* cwp-httpd -y
yum install cwp-httpd -y

after that rebuild webserver config.
"httpd" command doesn't work anymore.

"nginx" problem continues.
Code: [Select]
nginx: [emerg] bind() to 78.47.239.123:80 failed (98: Address already in use)
nginx: [emerg] bind() to 78.47.239.123:443 failed (98: Address already in use)
nginx: [emerg] bind() to 78.47.239.123:80 failed (98: Address already in use)
nginx: [emerg] bind() to 78.47.239.123:443 failed (98: Address already in use)
nginx: [emerg] bind() to 78.47.239.123:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
It also works.

Offline
****
if the service is already running, and you try to start it again, of course you are going to get bind errors.   try "nginx -s reload" if you want to reload config files, other than that, leave it alone.

Your only issue is apache failing to start due to trying to bind to port 80 as well.  That should have been resolved.  If your saying the systemctl doesn't list an httpd service:

nano /usr/lib/systemd/system/httpd.service

Code: [Select]
[Unit]
Description=Web server Apache
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/apache/bin/apachectl start
ExecReload=/usr/local/apache/bin/apachectl graceful
ExecStop=/usr/local/apache/bin/apachectl graceful-stop

[Install]
WantedBy=multi-user.target
systemctl enable httpd
systemctl start httpd
Google Hangouts:  rcschaff82@gmail.com

Offline
*
if the service is already running, and you try to start it again, of course you are going to get bind errors.   try "nginx -s reload" if you want to reload config files, other than that, leave it alone.

Your only issue is apache failing to start due to trying to bind to port 80 as well.  That should have been resolved.  If your saying the systemctl doesn't list an httpd service:

nano /usr/lib/systemd/system/httpd.service

Code: [Select]
[Unit]
Description=Web server Apache
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/apache/bin/apachectl start
ExecReload=/usr/local/apache/bin/apachectl graceful
ExecStop=/usr/local/apache/bin/apachectl graceful-stop

[Install]
WantedBy=multi-user.target
systemctl enable httpd
systemctl start httpd

I thought there was a problem. Thank you.

My PHP problems are still not resolved. I can't install in any way.
Do you have any idea about this?
http://forum.centos-webpanel.com/index.php?topic=8836.0


Offline
*
This solved the problem. My httpd.service was different, I don't know why. Thank you.

if the service is already running, and you try to start it again, of course you are going to get bind errors.   try "nginx -s reload" if you want to reload config files, other than that, leave it alone.

Your only issue is apache failing to start due to trying to bind to port 80 as well.  That should have been resolved.  If your saying the systemctl doesn't list an httpd service:

nano /usr/lib/systemd/system/httpd.service

Code: [Select]
[Unit]
Description=Web server Apache
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/apache/bin/apachectl start
ExecReload=/usr/local/apache/bin/apachectl graceful
ExecStop=/usr/local/apache/bin/apachectl graceful-stop

[Install]
WantedBy=multi-user.target
systemctl enable httpd
systemctl start httpd
André Bastos
ISBrasil Hospedagem de Site