Cannot forward to Openshift app (CNAME) - dns

I have a domain registered with GoDaddy, let's call it xyz.com
Now I add a CNAME
Host: openshift
Points To: myapp-mynamespace.rhcloud.com
When I access openshift.xyz.com I only get:
Not Found
The requested URL /app was not found on this server.
Apache/2.2.15 (Red Hat) Server at openshift.xyz.com Port 443
Not sure why it tried to access /app at all, not sure if it actually did forward to Openshift app.

You should config Cname in Godday
Add alias in openshift:
Using command line :
rhc alias add YOUR_APP_NAME www.xyz.com
Hope it help you

That means that you do not have the alias setup on your application correctly on OpenShift, and the server does not know what application to map that domain name to. Make sure that you have added your custom domain to your OpenShift gear correctly. Also, if you are using example.com and www.example.com, make sure that you added them both. This blog post should help get you fixed up: https://www.openshift.com/blogs/custom-url-names-for-your-paas-applications-host-forwarding-and-cnames-the-openshift-way

Related

add subdomain for node.js application in DirectAdmin

On my VPS I host several laravel applications.
Subdomains are added using DirectAdmin and VirtualHost settings are done using the DirectAdmin Httpd.conf customization, like:
|*if SUB="cluego"|
|?DOCROOT=/home/admin/domains/netwerkspel.nl/public_html/cluego/public|
|*endif|
|*if SUB="ijsbrekerz"|
|?DOCROOT=/home/admin/domains/netwerkspel.nl/public_html/ijsbrekerz/public|
|*endif|
Now I want to add the subdomain for qruzzle:
|*if SUB="qruzzle"|
|?DOCROOT=/home/admin/domains/netwerkspel.nl/public_html/qruzzle|
|*endif|
But qruzzle is a node.js application, and in the qruzzle directory a server.js is running on port 3000.
Can anyone tell me how I can configure this in the easiest way? Do I need to set up a reverse proxy? Is that possible using DirectAdmin?

How to setup Caddy to get HTTPS on my server

I've been issues to get the HTTPS address for my server. Let's say I have a domain www.mydomain.com
If I run this command it just works fine. I can get the HTTPS.
caddy -host www.domain.com
But I have some proxies that I use for django. So I have a CaddyFile. This is how the CaddyFile is set:
# Django
www.mydomain.com {
root /root/my_projects/my_project
proxy / 127.0.0.1:8000 {
transparent
except /static
}
log /var/log/caddy.log
So if I run this command
caddy -host CaddyFile
, it's not giving me HTTPS. Instead this is what the output is:
Activating privacy features... done.
Serving HTTP on port 2015
http://.:2015/caddyfile
So how should I configure the file or what command should I use to get HTTPS on my server with the proxy and the root folder that I set in the CaddyFile?
Thanks.
I'm guessing you use caddy v1.
From the caddy docs said:
-host
The default hostname or IP address to listen on. Sites defined in the Caddyfile without a hostname will assume this one. This is usually used with -port to quickly get simple sites up and running without a Caddyfile.
The -host option maybe ignored your Caddyfile.
If your Caddyfile is in the same directory with caddy binary, try remove all args, just run caddy. It will automatically picks up the Caddyfile.
Otherwise, try this caddy -conf <path/to/your/Caddyfile>

cPanel Server Incorrect URL Resolve

My cPanel server is resolving a URL wrong. The website example.com is hosted on my cPanel server at ip 1.0.0.1. In a script I am attempting a cURL command to cp.example.com which is hosted on another server at 2.0.0.2. My server is resolving cp.example.com to the IP of 1.0.0.1. Any help will be greatly appreciated!
It seems like your dns settings for cp.example.com are not visible on the host where you are running your script. You should check the dns settings for cp.example.com. You may also want to contact the Cpanel support
When you make a cURL request from a source hosted on your cPanel server the IP for the domain is first resolved locally, if it's not found in your Server's DNS zones it will be resolved from your configuration at /etc/resolv.conf
You can test to see which IP your server is resolving this by logging via SSH and pinging it
Executed from your cPanel Server
ping cp.example.com
I can think of two workarounds for this issue:
If example.com's DNS zone is hosted in your cPanel account
Go to cPanel -> Zone Editor
Open the DNS zone for example.com
Find the A record for cp.example.com
Change it to 2.0.0.2
If you have root - edit your WHM / cPanel Server's /etc/hosts file
root#server #: vim /etc/hosts
// 2.0.0.2 cp.example.com

Dokku - Add domain after setup

I installed Dokku on my Digital Ocean droplet, but did it before setting my dns records, so Dokku was installed on IP. Now I changed my dns record, so site can be accessed through site.com. I can access my previously created Dokku containers through site.com:port, how can I change Dokku settings to access my app like this - appname.site.com
Per https://github.com/progrium/dokku:
Set up a domain and a wildcard domain pointing to that host. Make sure
/home/dokku/VHOST is set to this domain. By default it's set to
whatever hostname the host has. This file is only created if the
hostname can be resolved by dig (dig +short $(hostname -f)). Otherwise
you have to create the file manually and set it to your preferred
domain. If this file still is not present when you push your app,
dokku will publish the app with a port number (i.e.
http://example.com:49154 - note the missing subdomain).
To fix the issue, you will first need to update the /home/dokku/VHOST file, adding the domain name -- this will fix any newly generated deployments, but existing apps will need to be deleted from the /home/dokku directory by name (/home/dokku/foo, /home/dokku/bar, etc.) and redeployed for this change to take effect, since each Dokku application has a separate nginx.conf within those /home/dokku/ paths and those will need to be re-written.
It is indeed not necessary to destroy and recreate apps. First, dokku domains:report tells you if global VHOSTS are already enabled or not. If not, run
dokku domains:add-global yourdomain.tld
echo yourdomain.tld | sudo tee -a /home/dokku/VHOST
dokku domains:add myapp myapp.yourdomain.tld
dokku domains:enable myapp
The first of these adds yourdomain.tld to /home/dokku/HOSTNAME. It should also add it to /home/dokku/VHOST, but it doesn't. So that needs to be done manually. Then tell dokku what (sub)domain you want to access myapp on. The last command sets the NO_VHOST variable for myapp to false.
To extend #shirkey answer: you don't need to re-create (destroy and create again) an app in order to apply those changes. You can manually create VHOST file inside /home/dokku/$APP/ directory (as dokku user) then remove NO_VHOST setting (dokku config:unset $app NO_VHOST) and change DOKKU_NGINX_PORT to 80 (dokku config:set $app DOKKU_NGINX_PORT=80) and restart the app (dokku ps:restart $app).
$ echo "example.com" > /home/dokku/VHOST
If you still could add a subdomain. These are the points to check.
Example: add myapp.example.com.
1, DNS(e.g. Namecheap)
If you are using Cloudflare, Check if Custom DNS is set to Cloudflare.
2, CDN(e.g. Cloudflare)
Check if it has A record like this.
Type | Name | Content
A | myapp | public ip address of Digital ocean server
3, VPS(e.g. Digital Ocean)
If you use Cloudflare you don’t have to set up Domain setting on Digital Ocean.
4, Dokku
Is port mapping set up properly? dokku proxy:report to check port 80
is mapped to the port of container.
Is the server running? Use curl from inside the server.
If you still could not locate the cause of the problem, check nginx config file like /home/dokku/appname/nginx.conf /etc/nginx/nginx.conf manually.
Example /home/dokku/appname/nginx.conf file
server {
listen [::]:80;
listen 80;
server_name myapp.example.com;
location / {
proxy_pass http://myapp-3030;
}
upstream myapp-3030 {
server 172.17.0.4:3030;
}

Assigning a domain name to localhost for development environment

I am building a website and would not like to reconfigure the website from pointing to http://127.0.0.1 to http://www.example.com. Furthermore, the certificate that I am using is of course made with the proper domain name of www.example.com but my test environment makes calls to 127.0.0.1 which makes the security not work properly.
What I currently want to do is configure my development environment to assign the domain name www.example.com to 127.0.0.1 so that all http://www.example.com/xyz is routed to http://127.0.0.1:8000/xyz and https://www.example.com/xyz is routed to https://127.0.0.1:8080/xyz.
I am not using Apache. I am currently using node.js as my web server and my development environment is in Mac OS X Lion.
If you edit your etc/hosts file you can assign an arbitrary host name to be set to 127.0.0.1.
Open up /etc/hosts in your favorite text editor and add this line:
127.0.0.1 www.example.com
Unsure of how to avoid specifying the port in the HTTP requests you make to example.com, but if you must avoid specifying that at the request level, you could run nodejs as root to make it listen on port 80.
Edit: After editing /etc/hosts, you may already have the DNS request for that domain cached. You can clear the cached entry by running this on the command line.
dscacheutil -flushcache

Resources