███████╗██╗ ██╗██╗██████╗ ██████╗ ██╗ ██╗███████╗ ██╔════╝██║ ██║██║██╔══██╗╚════██╗██║ ██║╚════██║ ███████╗███████║██║██████╔╝ █████╔╝███████║ ██╔╝ ╚════██║██╔══██║██║██╔═══╝ ██╔═══╝ ╚════██║ ██╔╝ ███████║██║ ██║██║██║ ███████╗ ██║ ██║ ╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚══════╝ ╚═╝ ╚═╝
Shipl. Buidl. Repetl.
I like to have a global domain set (eg. example.com) with a wildcard subdomain (*.example.com) and VHOSTS enabled for my apps. This means if I create an app superawesome it will immediately be available as a subdomain on superawesome.example.com.
Problem is that by default even if you type in random-name.example.com a default website will be visible. To quote Dokku’s docs:
By default, dokku will route any received request with an unknown HOST header value to the lexicographically first site in the nginx config stack
In order to limit this routing you can modify your nginx file (/etc/nginx/sites-enabled/default
) like so:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 404;
log_not_found off;
}
Then you have to reload your nginx server: sudo service nginx reload
Result of this is that:
Fore more details have a look at Dokku’s docs about domain configuration.
\0