mail-in-a-box / mailinabox

Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
https://mailinabox.email/
Creative Commons Zero v1.0 Universal
13.92k stars 1.43k forks source link

Installation: Nginx fails to start if IPv6 is disabled on host #1783

Open octoquad opened 4 years ago

octoquad commented 4 years ago

As mentioned in your setup guide: "If you have a choice, choose a location for your machine that is near you — it’ll be faster! And if disabling IPv6 is an option, disable it." if IPv6 is completely disabled on the server, then Nginx fails with [emerg] socket() [::]:80 failed (97: Address family not supported by protocol).

$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
nginx: configuration file /etc/nginx/nginx.conf test failed

This results in the installation failing when starting up Nginx.

To reproduce you can do the following:

sudo sed -i -e 's/GRUB_CMDLINE_LINUX_DEFAULT="maybe-ubiquity"/GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 maybe-ubiquity"/' /etc/default/grub
sudo sed -i -e 's/GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="ipv6.disable=1"/' /etc/default/grub
sudo update-grub
sudo reboot
curl -s https://mailinabox.email/setup.sh | sudo -E bash

Workaround

  1. Re-enable IPv6 by removing ipv6.disable=1 in /etc/default/grub
  2. Remove the listen [::]:80 default_server; from the server block from /etc/nginx/sites-available/default or
  3. Remove the symlink in /etc/nginx/sites-enabled/default
octoquad commented 4 years ago

Reviewing the logs after installation, it looks like dovecot fails to start as well. I've reverted and enabled IPv6 for the host and re-installed. Perhaps the documentation just needs to be updated to be clearer on where IPv6 should be disabled or removed?