dokku-nginx-alt is a alternative plugin for dokku's built in nginx-vhosts. This plugin supports:
- Multiple custom domains for each app (e.g. myapp.com, www.myapp.com, and
production.myapp.com can all be served by the same app). These domains
are defined in the
VHOSTfile, with each domain name on a new line. - Ability to override
nginx.conf. Simply placenginx.tplornginx.ssl.tplfiles into the app's home directory (i.e./home/dokku/[app name]/). Upon push, these templates will be used.
In more detail:
- Moved configuration file from
post-deployinto separate template files:nginx.confandnginx.ssl.conf. - Ability to override default .conf files with user's own nginx configuration
files placed in
/home/dokku/$APP/. - Ability to deploy an app under multiple custom domains. The
VHOSTfile can now contain a list of domains that nginx will serve to. VHOSTfile is decoupled frompost-deployin thatpost-deployno longer overwritesVHOSTafter each deploy. Custom domains are set independently in theVHOSTfile.- Ability to mix SSL and non-SSL domains. For example,
VHOSTmay containmydomain.comand*.mydomain.comwhere SSL certificates only apply to*.mydomain.com. This plugin generates both SSL configurations for the wildcard domains and non-SSL configuration for the root domain. - Added helper messages during deploy.
This plugin has been tested on dokku version 0.2.3.
-
Install the plugin by cloning into the dokku plugins directory:
git clone https://github.com/mikexstudios/dokku-nginx-alt.git /var/lib/dokku/plugins/nginx-alt
Do not delete the existing
nginx-vhosts/plugin that ships with dokku. -
Then run dokku's plugin install:
dokku plugins-install
This step renames
nginx-vhosts/to.nginx-vhosts/and calls.nginx-vhosts/install. -
Create a
VHOSTfile in your dokku app directory (e.g./home/dokku/[app name]/VHOST) and add each domain name on a separate line. -
To override the default
nginx.confand/ornginx.ssl.conftemplates, place copies renamed asnginx.tpland/ornginx.ssl.tplin your/home/dokku/[app name]/directory. When you re-push your application, you should see a message like:-----> Overriding default SSL nginx.conf with detected nginx.tpl... -
Re-push your app.
backup-exportandbackup-importhook scripts have intentionally not been included to reduce the complexity of this plugin.
The MIT License (MIT)