diff --git a/run-document-server.sh b/run-document-server.sh
index 008de7ba312fedfa7cb663e919c4a66ea41933aa..29ea5be673e3d08d6b5df9fd3980e54ca9865379 100755
--- a/run-document-server.sh
+++ b/run-document-server.sh
@@ -277,6 +277,11 @@ update_nginx_settings(){
     ln -sf ${NGINX_ONLYOFFICE_PATH}/ds.conf.tmpl ${NGINX_ONLYOFFICE_CONF}
   fi
 
+  # check if ipv6 supported otherwise remove it from nginx config
+  if [ ! -f /proc/net/if_inet6 ]; then
+    sed '/listen\s\+\[::[0-9]*\].\+/d' -i $NGINX_ONLYOFFICE_CONF
+  fi
+
   if [ -f "${NGINX_ONLYOFFICE_EXAMPLE_CONF}" ]; then
     sed 's/linux/docker/' -i ${NGINX_ONLYOFFICE_EXAMPLE_CONF}
   fi