How to point a Dokku app at the root domain of the dokku server - nginx

How do I point a dokku app that will set up in the dokku server, to point at the root domain of the server itself. Suppose my domain is apps.com and the app to be implemented is called botapp. If I use virtualhost naming, and do git remote add dokku dokku#apps.com:botapp it will get pointed at botapp.apps.com. What do I do to get the botapp pointed at apps.com itself (the root domain).
Also, how do I know what port a dokku app is rooting, inspite of using subdomains (virtualhost naming)?

As of v0.3.10, Dokku ships with a domains plugin. This lets you easily add domains to your app. By default your app is located at myapp.mydomain.com. If you want your app to be accessible via the root domain, then just add the root domain as one of your app's domains. dokku domains:add myapp mydomain.com.
That was really straightforward, the docs need to be updated to reflect this, really.
For your second question, your app is not visible to the outside world. Your app is running inside its own docker container, with its own local IP address. If you still want to find out what port your app has exposed, you can run docker ps on your server.

Related

Dokku subdomain cant be found

I deployed an app to my Digital Ocean Dokku instance, and set it up with a domain such that https://example.com (using letsencrypt dokku plugin) points to my originalApp. I recently tried to deploy a second app on my Dokku instance thinking I would be able to access it with http://newApp.example.com, and eventually use new-example.com to access it.
However, I cannot access my new app.
dokku domains:report yields:
=====> newApp domains information
Domains app enabled: true
Domains app vhosts: new-example.com newApp.example.com
Domains global enabled: true
Domains global vhosts: example.com
=====> originalApp domains information
Domains app enabled: true
Domains app vhosts: example.com
Domains global enabled: true
Domains global vhosts: example.com
The final goal is to have two separate domains pointing to their respective apps. (Is this even possible?) But at the moment, I can't even get the subdomains to work.
I confirmed the app is running by dokku logs newApp
In the Digital Ocean > Networking section, my newDomain.com has the Digital Ocean NS records as well as the A record to my Droplet's IP.
Could this have something to do with my nginx setup or letsencrypt?
Its possible, I have done it several times with DigitalOcean droplets and you will have your mini-Heroku at last. It's a kind of tricky to get it working but I will try to explain my steps to replicate it.
First of all you need to deploy your DO droplet with Dokku to get started. Remember to select the option "Use virtualhost naming for apps" during the installation!
In your DNS you will have to configure an A record to access your server with a domain that will hold your different apps (subdomains).
Creating a "base" A record for the Dokku instance can make it easier to access, but is not required (only affects instance, not app subdomains!).
# Enable app subdomain routing
A *.apps.example.com <public IP address>
# Optional subdomain for Dokku instance
A apps.example.com <public IP address>
Now you need to deploy your two apps on the server to get started with the configuration. Create the apps and deploy them (Use google if you need help to deploy it). Finally, you should see this in your server:
root#server-dokku-apps:~# dokku apps:list
=====> My Apps
acme-website
bubba-gump-website
Now you will need to configure the domain for each Dokku app.
root#server-dokku-apps:~# dokku domains:add acme-website www.acmewebsite.com
-----> Added www.acmewebsite.com to acme-website
-----> Configuring www.acmewebsite.com...(using built-in template)
-----> Configuring acme-website.apps.example.com...(using built-in template)
-----> Configuring www.acmewebsite.com...(using built-in template)
-----> Creating https nginx.conf
-----> Running nginx-pre-reload
Reloading nginx
root#server-dokku-apps:~# dokku domains:add bubba-gump-website www.bubbagump.com
-----> Added www.bubbagump.com to bubba-gump-website
-----> Configuring www.bubbagump.com...(using built-in template)
-----> Configuring bubba-gump-website.apps.example.com...(using built-in template)
-----> Configuring www.bubbagump.com...(using built-in template)
-----> Creating https nginx.conf
-----> Running nginx-pre-reload
Reloading nginx
Check that you can access the apps using the default Dokku domains (only http so far):
http://acme-website.apps.example.com
http://bubba-gump-website.apps.example.com
If everything is working as expected, configure each domain to point to the right app with some CNAME records.
# In your www.acmewebsite.com DNS records
CNAME www.acmewebsite.com www.acmewebsite.com.apps.example.com
# In your www.bubbagump.com DNS records
CNAME www.bubbagump.com www.bubbagump.com.apps.example.com
The final step is to configure letsencrypt on each app. To let letssencrypt provide a new certificate, your new domain (ex. www.acmewebsite.com) need to be accessible. This is why we first need to place the DNS CNAME! Remember to install dokku-letsencrypt on your server.
# First for acme website
root#server-dokku-apps:~# dokku letsencrypt acme-website
# Finally for buba website
root#server-dokku-apps:~# dokku letsencrypt bubba-gump-website
After all this mess you should have two shiny apps running in their own domains with HTTPS enabled.
Hope this helps.

Multiple dokku apps one domain

The behavior I want:
If the user goes to http://www.example.com/{anything-but-admin} one dokku app responds.
However if the user goes to http://www.example.com/admin a different dokku app responds.
Does dokku provide a simple way to do this? I believe I would have to disable the proxy port mapping and add a custom nginx implementation, but even if I do that, the docs specify
If a proxy is disabled, Dokku will bind your container's port to a random port on the host for every deploy, e.g. 0.0.0.0:32771->5000/tcp.
If this is the correct thing to do, how do I force a static port number, so I can add that port number to my custom nginx configuration?
You can deploy two apps and have one of the apps reference the other's upstream.

Make local web app accessable by http://LocalComputer/WebsiteName on IIS

I am trying to make web app accessible by http://LocalComputer/WebsiteName on IIS.
I am able to access it by http://computername:portnumber/
So what does my binding need to be and do I need a static ip?
Any help or redirection to appropriate resources will be greatly appreciated!
Is IIS setup on default port 80? If your document root is setup to website, you should be able to access it via http://computername/. If this is a local setup, and assuming your DNS is setup and working on the router, wont need a static IP although doubtful IP will ever change.
http://LocalComputer/WebsiteName this can be done locally without a static IP.
In order to make it publically over http you would need below things.
1) Registered domain name
2) Registered name servers
3) DNS zone created for the domain either with registrar or on the server
You can either host this website by renting a Windows VPS or a server and with the help of third party control panels like Plesk or Hosting controller.
OR
You can purchase a shared web hosting space from a windows hosting provider and upload your pages to make the contents accessible publically.
Another option would be to set multiple domains in your hosts file
domain1 192.168.0.10
domain2 192.168.0.10
...
Set IIS to bind and hosts multiple domain on the same IP. Then you can access each site locally by going to http://domain1 or http://domain2 etc...

How to configure Nginx for different subdomains via different ports?

I've struggled for couple of weeks on this configuration.What I want to achieve can be listed as follows.
1.I registered a domain not long ago.And I've set up some web service on my VPS,such as a blog,a forum and Owncloud. Now I want to configured the Nginx so that I can run all the service on one VPS and one IP address. In order to run owncloud,I have to modify the /etc/php5/fpm/pool.d/www.confto listen = 9000.In this case,I can only get one service (Owncloud)function,because if I want to run the forum I must uncomment the listen = /var/run/php5-fpm.sock.What's more,I've tried to uncomment both of them,Nginx showed 502 afterwards.
2.I'm using Hexo as my blog.When I start the server,I can access into my blog on IP:4000.So I wonder if I could run my blog server on background and edit the posts online via a subdomain which has been redirected to port 4000.If it's possible,should I modify the nginx.conf or add something in sites-available?
3.Can I deploy different web services on different subdomain?Which file is to modify?It's said that I can achieve this by using reverse proxy?
Sorry for the pathetic English and expression.Thanks in advance.
Going at it point by point:
The advantage of PHP-FPM, which you are using, is that you can have multiple separate interpreters running in your pool. To do so, simply copy the file at /etc/php5/fpm/pool.d/www.conf to somewhere else, say /etc/php5/fpm/pool.d/forum.conf, change the listen directive, and you've got a second php interpreter running, entirely separate from the first one. That way owncloud (www) and your forum (forum) have their own distinct php.
This is called reverse-proxying. nginx does that well. You simply add a new site definition in sites-available that does reverse-proxying to port 4000 on your server, then symlink (or copy) that site definition to sites-enabled and restart nginx. You will have to setup Hexo to start automatically for that to work.
You can deploy different web services on different subdomains. As long as the dns is configured to point that name to your server, you can configure the server to respond differently for every subdomain using site definitions. You need to modify the files in sites-enabled to determine which names nginx knows how to respond to.

Access dokku app from same external port without configuring vhost

I have a dokku app configuring without a VHOST and the external port number changes upon each new deployment. How can I get access to a consistent external port? I noticed the internal port is consistent so I just need some direction on how to accomplish this.

Resources