dokku-redirect: [emerg] invalid port in "[::]:" of the "listen" directive

I successfully used this plugin on Dokku 0.4.14.

Now, I’ve updated straight to Dokku 0.5.3, which works fine. However, when I try to set a new redirect, I have this error:

 ~ dokku redirect:set myapp app.com www.app.com
-----> Setting redirect for myapp...
-----> Configuring myapp...(using built-in template)
-----> Configuring www.app.com...(using built-in template)
-----> Creating http nginx.conf
-----> Running nginx-pre-reload
-----> Configuring redirect for app.com to www.app.com...
       Reloading nginx
nginx: [emerg] invalid port in "[::]:" of the "listen" directive in /home/dokku/myapp/nginx.conf:40
nginx: configuration file /etc/nginx/nginx.conf test failed

www.myapp.com is a domain already assigned to myapp; myapp.com isn’t.

Here’s the bit of content which has been added at the end of /home/dokku/myapp/nginx.conf after running the above (failed) command:

server {
  listen      [::]:;
  listen      ;
  server_name app.com;
  return 301 $scheme://www.app.com$request_uri;
}

=> It seems the port is not set?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 27 (18 by maintainers)

Commits related to this issue

Most upvoted comments

@michaelshobbs yeaaah you’re right, after destroying the app and pushing again, this worked fine!

removing EXPOSE 80 from Dockerfile and changing listen 80; to listen 5000; in .nginf.conf

I’ll update my other Dockerfiles. Many thanks!

Ah! I think the first on failed because of some leftovers from the original deployment. Soooooo, modify your app repo as mentioned previously. Then destroy the app using dokku apps:destroy and push it again. That should work from a fresh app push.