import os

bind = f'[::]:{os.getenv("PAPERLESS_PORT", 8000)}'
workers = int(os.getenv("PAPERLESS_WEBSERVER_WORKERS", 1))
worker_class = "paperless.workers.ConfigurableWorker"
timeout = 120


def pre_fork(server, worker):
    pass


def pre_exec(server):
    server.log.info("Forked child, re-executing.")


def when_ready(server):
    server.log.info("Server is ready. Spawning workers")


def worker_int(worker):
    worker.log.info("worker received INT or QUIT signal")

    ## get traceback info
    import threading, sys, traceback

    id2name = {th.ident: th.name for th in threading.enumerate()}
    code = []
    for threadId, stack in sys._current_frames().items():
        code.append("\n# Thread: %s(%d)" % (id2name.get(threadId, ""), threadId))
        for filename, lineno, name, line in traceback.extract_stack(stack):
            code.append('File: "%s", line %d, in %s' % (filename, lineno, name))
            if line:
                code.append("  %s" % (line.strip()))
    worker.log.debug("\n".join(code))


def worker_abort(worker):
    worker.log.info("worker received SIGABRT signal")

gunicorn.conf.py
import os

bind = f'{os.getenv("PAPERLESS_BIND_ADDR", "[::]")}:{os.getenv("PAPERLESS_PORT", 8000)}'
workers = int(os.getenv("PAPERLESS_WEBSERVER_WORKERS", 1))
worker_class = "paperless.workers.ConfigurableWorker"
timeout = 120


def pre_fork(server, worker):
    pass


def pre_exec(server):
    server.log.info("Forked child, re-executing.")


def when_ready(server):
    server.log.info("Server is ready. Spawning workers")


def worker_int(worker):
    worker.log.info("worker received INT or QUIT signal")

    ## get traceback info
    import threading, sys, traceback

    id2name = {th.ident: th.name for th in threading.enumerate()}
    code = []
    for threadId, stack in sys._current_frames().items():
        code.append("\n# Thread: %s(%d)" % (id2name.get(threadId, ""), threadId))
        for filename, lineno, name, line in traceback.extract_stack(stack):
            code.append('File: "%s", line %d, in %s' % (filename, lineno, name))
            if line:
                code.append("  %s" % (line.strip()))
    worker.log.debug("\n".join(code))


def worker_abort(worker):
    worker.log.info("worker received SIGABRT signal")

gunicorn.conf.py
diff --git a/docs/configuration.rst b/docs/configuration.rst
index fd68f61cbf9..dce6b3a83d8 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -808,6 +808,13 @@ PAPERLESS_WEBSERVER_WORKERS=<num>
 
     Defaults to 1.
 
+PAPERLESS_BIND_ADDR=<ip address>
+    The IP address the webserver will listen on inside the container. There are
+    special setups where you may need to configure this value to restrict the
+    Ip address or interface the webserver listens on.
+
+    Defaults to [::], meaning all interfaces, including IPv6.
+
 PAPERLESS_PORT=<port>
     The port number the webserver will listen on inside the container. There are
     special setups where you may need this to avoid collisions with other
diff --git a/gunicorn.conf.py b/gunicorn.conf.py
index 7193815b367..daebd4bea33 100644
--- a/gunicorn.conf.py
+++ b/gunicorn.conf.py
@@ -1,6 +1,6 @@
 import os
 
-bind = f'[::]:{os.getenv("PAPERLESS_PORT", 8000)}'
+bind = f'{os.getenv("PAPERLESS_BIND_ADDR", "[::]")}:{os.getenv("PAPERLESS_PORT", 8000)}'
 workers = int(os.getenv("PAPERLESS_WEBSERVER_WORKERS", 1))
 worker_class = "paperless.workers.ConfigurableWorker"
 timeout = 120

[BUG] Error starting gunicorn when IPv6 is disabled on host
### Description

Paperless fails to launch in at least certain scenarios when IPv6 is disabled on the host. This was working before a change from listening on `0.0.0.0` to listening on `::`.

### Steps to reproduce

Add the following to `/etc/sysctl.conf`:

```
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
```

Set `GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"` in `/etc/default/grub`, and `update-grub`.

Reboot and run paperless-ngx

### Webserver logs

```bash
Paperless-ngx docker container starting...
Mapping UID and GID for paperless:paperless to 1000:65538
usermod: no changes
Creating directory /tmp/paperless
Adjusting permissions of paperless files. This may take a while.
Waiting for PostgreSQL to start...
Waiting for Redis: redis://paperless-redis.paperless.svc:6379
Connected to Redis broker: redis://paperless-redis.paperless.svc:6379
Apply database migrations...
Operations to perform:
  Apply all migrations: admin, auth, authtoken, contenttypes, django_q, documents, paperless_mail, sessions
Running migrations:
  No migrations to apply.
Executing /usr/local/bin/paperless_cmd.sh
2022-08-04 14:20:24,984 INFO Set uid to user 0 succeeded
2022-08-04 14:20:24,985 INFO supervisord started with pid 49
2022-08-04 14:20:25,988 INFO spawned: 'consumer' with pid 50
2022-08-04 14:20:25,990 INFO spawned: 'gunicorn' with pid 51
2022-08-04 14:20:25,992 INFO spawned: 'scheduler' with pid 52
[2022-08-04 10:20:26 -0400] [51] [INFO] Starting gunicorn 20.1.0
[2022-08-04 10:20:35 -0400] [72] [ERROR] Retrying in 1 second.
[2022-08-04 10:20:36 -0400] [72] [ERROR] Retrying in 1 second.
[2022-08-04 10:20:37 -0400] [72] [ERROR] Can't connect to ('::', 8000)
2022-08-04 14:20:37,727 INFO exited: gunicorn (exit status 1; not expected)
2022-08-04 14:20:38,730 INFO spawned: 'gunicorn' with pid 74
[2022-08-04 10:20:39 -0400] [74] [INFO] Starting gunicorn 20.1.0
[2022-08-04 10:20:39 -0400] [74] [ERROR] Retrying in 1 second.
2022-08-04 14:20:40,017 INFO success: gunicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
[2022-08-04 10:20:40 -0400] [74] [ERROR] Retrying in 1 second.
[2022-08-04 10:20:41 -0400] [74] [ERROR] Retrying in 1 second.
[2022-08-04 10:20:42 -0400] [74] [ERROR] Retrying in 1 second.
[2022-08-04 10:20:43 -0400] [74] [ERROR] Retrying in 1 second.
[2022-08-04 10:20:44 -0400] [74] [ERROR] Can't connect to ('::', 8000)
2022-08-04 14:20:44,069 INFO exited: gunicorn (exit status 1; not expected)
```


### Paperless-ngx version

1.8.0

### Host OS

Ubuntu 22.04 x64, Microk8s 1.22

### Installation method

Docker - official image

### Browser

_No response_

### Configuration changes

_No response_

### Other

This seems to be a regression from https://github.com/paperless-ngx/paperless-ngx/pull/924. Changing the listen IP back to 0.0.0.0 in gunicorn.conf.py causing it to bind correctly again
