0

Apache is not installed, just nginx.

Upon booting Ubuntu 22.04:

$ service nginx status
× 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 Wed 2022-07-20 13:09:24 EDT; 11s ago
       Docs: man:nginx(8)
    Process: 972 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 1010 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
        CPU: 42ms

Jul 20 13:09:21 gojira nginx[1010]: nginx: [warn] duplicate MIME type "text/html" in /etc/nginx/sites-enabled/scalacourses.com:24
Jul 20 13:09:21 gojira nginx[1010]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Unknown error)
Jul 20 13:09:22 gojira nginx[1010]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Unknown error)
Jul 20 13:09:22 gojira nginx[1010]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Unknown error)
Jul 20 13:09:23 gojira nginx[1010]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Unknown error)
Jul 20 13:09:23 gojira nginx[1010]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Unknown error)
Jul 20 13:09:24 gojira nginx[1010]: nginx: [emerg] still could not bind()
Jul 20 13:09:24 gojira systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Jul 20 13:09:24 gojira systemd[1]: nginx.service: Failed with result 'exit-code'.
Jul 20 13:09:24 gojira systemd[1]: Failed to start A high performance web server and a reverse proxy server.

$ sudo systemctl start nginx
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.

$ sudo systemctl disable nginx
Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable nginx
Removed /etc/systemd/system/multi-user.target.wants/nginx.service.

$ sudo systemctl enable nginx
Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nginx
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /lib/systemd/system/nginx.service.

$ sudo systemctl start nginx
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.

$ sudo systemctl stop nginx

$ sudo systemctl start nginx

$ service nginx status
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-07-20 13:12:24 EDT; 11s ago
       Docs: man:nginx(8)
    Process: 6517 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 6518 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 6519 (nginx)
      Tasks: 9 (limit: 38369)
     Memory: 8.6M
        CPU: 37ms
     CGroup: /system.slice/nginx.service
             ├─6519 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
             ├─6520 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
             ├─6521 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
             ├─6522 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
             ├─6523 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
             ├─6524 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
             ├─6525 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
             ├─6526 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
             └─6527 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

Jul 20 13:12:24 gojira systemd[1]: Starting A high performance web server and a reverse proxy server...
Jul 20 13:12:24 gojira nginx[6517]: nginx: [warn] duplicate MIME type "text/html" in /etc/nginx/sites-enabled/scalacourses.com:24
Jul 20 13:12:24 gojira nginx[6518]: nginx: [warn] duplicate MIME type "text/html" in /etc/nginx/sites-enabled/scalacourses.com:24
Jul 20 13:12:24 gojira systemd[1]: Started A high performance web server and a reverse proxy server.

$ grep -r listen /etc/nginx/*
/etc/nginx/nginx.conf:#     listen     localhost:110;
/etc/nginx/nginx.conf:#     listen     localhost:143;
/etc/nginx/sites-available/scalacourses.com:  listen 80;
/etc/nginx/sites-available/scalacourses.com:  listen [::]:80 ipv6only=on;
/etc/nginx/sites-available/scalacourses.com:  listen 443 ssl;
/etc/nginx/sites-available/scalacourses.com:  listen [::]:443 ipv6only=on ssl;
/etc/nginx/sites-available/default: listen 80 default_server;
/etc/nginx/sites-available/default: listen [::]:80 default_server;
/etc/nginx/sites-available/default: # listen 443 ssl default_server;
/etc/nginx/sites-available/default: # listen [::]:443 ssl default_server;
/etc/nginx/sites-available/default:#    listen 80;
/etc/nginx/sites-available/default:#    listen [::]:80;
/etc/nginx/sites-enabled/scalacourses.com:  listen 80;
/etc/nginx/sites-enabled/scalacourses.com:  listen [::]:80 ipv6only=on;
/etc/nginx/sites-enabled/scalacourses.com:  listen 443 ssl;
/etc/nginx/sites-enabled/scalacourses.com:  listen [::]:443 ipv6only=on ssl;

What might cause this behavior?

Mike Slinn
  • 7,705
  • 5
  • 51
  • 85
  • solve the errors shown...? (I do mean this one, which is give 5 times: `gojira nginx[1010]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Unknown error)` ) – Luuk Jul 20 '22 at 17:26
  • Possible duplicate of: [nginx - nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)](https://stackoverflow.com/questions/14972792/nginx-nginx-emerg-bind-to-80-failed-98-address-already-in-use) or [Unknown error nginx](https://stackoverflow.com/questions/17241554/unknown-error-nginx) – Luuk Jul 20 '22 at 17:29
  • @Luuk I added the output of grep -r listen /etc/nginx/* to the question. I think port 443 handling is ok in config files. – Mike Slinn Jul 20 '22 at 17:38

1 Answers1

0

I discoverd that another service, pound, started before nginx and grabbed port 443. I no longer need pound, so I deleted the link that caused it to start:

$ sudo rm /etc/rc2.d/S04pound
Mike Slinn
  • 7,705
  • 5
  • 51
  • 85