Is there a conflict between Debian Bullseye and nginx?

M
  • 16 Dec '22
I am running Debian Bullseye: this is a stripped down Command Line only install without a GUI. It runs apache2 and ISC-BIND only in a VirtualBox VM.

# uname -r
5.10.0-19-amd64
# nginx -v
nginx version: nginx/1.23.2
# apache2 -v
Server version: Apache/2.4.54 (Debian)
Server built:   2022-06-08T16:00:36

This is NOT commented out:
pid /run/nginx.pid; 

apache2 - runs with no problems. syslog is clear of any error message from anything. 

I was looking to use LetsEncrypt which uses nginx.

** While apache2 is running, if I try to start nginx I get this. **

 nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2022-12-16 15:54:02 PST; 58s ago
       Docs: man:nginx(8)
    Process: 38159 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 38160 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; ([b]code=exited, status=1/FAILURE[/b])
        CPU: 51ms

Dec 16 15:54:00 www nginx[38160]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec 16 15:54:00 www nginx[38160]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec 16 15:54:01 www nginx[38160]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec 16 15:54:01 www nginx[38160]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec 16 15:54:01 www nginx[38160]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec 16 15:54:01 www nginx[38160]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec 16 15:54:02 www nginx[38160]: nginx: [emerg] still could not bind()
Dec 16 15:54:02 www systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Dec 16 15:54:02 www systemd[1]: nginx.service: Failed with result 'exit-code'.
Dec 16 15:54:02 www systemd[1]: Failed to start A high performance web server and a reverse proxy server.

If I stop apache2 then nginx loads **BUT** then apache2 refused to load with this statement:

Starting apache2 (via systemctl): apache2.serviceJob for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
 failed!
root at www:/home/mike# systemctl status apache2.service
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2022-12-16 15:57:04 PST; 17s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 38198 ExecStart=/usr/sbin/apachectl start ([b]code=exited, status=1/FAILURE[/b])
        CPU: 32ms

Dec 16 15:57:04 www systemd[1]: Starting The Apache HTTP Server...
Dec 16 15:57:04 www apachectl[38201]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Dec 16 15:57:04 www apachectl[38201]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Dec 16 15:57:04 www apachectl[38201]: no listening sockets available, shutting down
Dec 16 15:57:04 www apachectl[38201]: AH00015: Unable to open logs
Dec 16 15:57:04 www apachectl[38198]: Action 'start' failed.
Dec 16 15:57:04 www apachectl[38198]: The Apache error log may have more information.
Dec 16 15:57:04 www systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Dec 16 15:57:04 www systemd[1]: apache2.service: Failed with result 'exit-code'.
Dec 16 15:57:04 www systemd[1]: Failed to start The Apache HTTP Server.
F
  • 16 Dec '22
On Fri, Dec 16, 2022 at 04:27:15PM +0800, Mike Lieberman wrote:

Hi there,

You have configured your nginx to listen on port 80 on all IP addresses.

You have configured your apache to listen on port 80 on all IP addresses.

They can't both do that at the same time.

The first one works, the other one fails.

If you want both to be running, you must configure them to listen on
different IP:ports from each other.

This is normal.

Cheers,

    f
-- 
Francis Daly        francis at daoine.org
M
  • 16 Dec '22
On Fri, 2022-12-16 at 15:59 +0000, Francis Daly wrote:

> On Fri, Dec 16, 2022 at 04:27:15PM +0800, Mike Lieberman wrote:
> 
> Hi there,
> 
> You have configured your nginx to listen on port 80 on all IP addresses.
> 
> You have configured your apache to listen on port 80 on all IP addresses.
> 
> They can't both do that at the same time.
> 
> The first one works, the other one fails.
> 
> If you want both to be running, you must configure them to listen on
> different IP:ports from each other.
> 
> This is normal.
> 
> Cheers,
> 
>         f

Actually, I didn't configure it on any port. I was following a guide in https://www.linuxcapable.com/how-to-install-nginx-with-lets-encrypt-tls-ssl-on-debian-11-bullseye. However I can't get brotli to be accepted in /etc/nginx/nginx.conf (as specified in the guide) and nginx you say I have it looking at port 80, but (a) I don't [at least not by my direction] and the guide does not specify anything regarding that. Clearly the guide is wrong and I will have to find another way to approach this.

Thank you for your clear comments. It is I who is over my head.
J
  • 16 Dec '22
On Fri, Dec 16, 2022 at 11:23 AM Mike Lieberman <mike at netwright.net> wrote:
>
> On Fri, 2022-12-16 at 15:59 +0000, Francis Daly wrote:
>
> > On Fri, Dec 16, 2022 at 04:27:15PM +0800, Mike Lieberman wrote:
> >
> > You have configured your nginx to listen on port 80 on all IP addresses.
> >
> > You have configured your apache to listen on port 80 on all IP addresses.
> >
> > They can't both do that at the same time.
> >
> > The first one works, the other one fails.
> >
> > If you want both to be running, you must configure them to listen on
> > different IP:ports from each other.
>
> Actually, I didn't configure it on any port. I was following a guide in https://www.linuxcapable.com/how-to-install-nginx-with-lets-encrypt-tls-ssl-on-debian-11-bullseye. However I can't get brotli to be accepted in /etc/nginx/nginx.conf (as specified in the guide) and nginx you say I have it looking at port 80, but (a) I don't [at least not by my direction] and the guide does not specify anything regarding that. Clearly the guide is wrong and I will have to find another way to approach this.

If 80 and 443 are in use, you typically move on to the next set of
well known ports, like 8080 and 8443. Or you can use random port
numbers. You can move Apache or Nginx.

Jeff