title: nginx on Ubuntu does not start on boot
body: <p>Apache is not installed, just nginx.</p>
  <p>Upon booting Ubuntu 22.04:</p>
  <pre><code>$ 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 &quot;text/html&quot; 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 &quot;systemctl status nginx.service&quot; and &quot;journalctl -xeu nginx.service&quot; 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 &quot;systemctl status nginx.service&quot; and &quot;journalctl -xeu nginx.service&quot; 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 &quot;nginx: master process /usr/sbin/nginx -g daemon on; master_process on;&quot;
               ├─6520 &quot;nginx: worker process&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot;
               ├─6521 &quot;nginx: worker process&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot;
               ├─6522 &quot;nginx: worker process&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot;
               ├─6523 &quot;nginx: worker process&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot;
               ├─6524 &quot;nginx: worker process&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot;
               ├─6525 &quot;nginx: worker process&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot;
               ├─6526 &quot;nginx: worker process&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot;
               └─6527 &quot;nginx: worker process&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot;
  
  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 &quot;text/html&quot; in /etc/nginx/sites-enabled/scalacourses.com:24
  Jul 20 13:12:24 gojira nginx[6518]: nginx: [warn] duplicate MIME type &quot;text/html&quot; 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;
  </code></pre>
  <p>What might cause this behavior?</p>