Not able to configure Caddy server to use TLS with my domain name - webserver

I already have pointed domain's A/AAAA records point to my server's IP address and I do see Caddy home page when I put my server's IP address in the browser but not with domain name.
Not sure if my Caddyfile changes are even getting reloaded.
Hit in browser:
http://10.20.30.40 -- I see Caddy home page when I hit my machine's ip address
http://www.mytekworld.com -- The browser just keeps spinning when I hit the domain name
https://www.mytekworld.com -- The browser just keeps spinning when I hit the domain name
sudo nano /etc/caddy/Caddyfile
# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace the line below with your
# domain name.
www.mytekworld.com
# Set this path to your site's directory.
root * /usr/share/caddy
# Enable the static file server.
file_server
# Another common task is to set up a reverse proxy:
# reverse_proxy localhost:8080
# Or serve a PHP site through php-fpm:
# php_fastcgi localhost:9000
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile
--Reload caddy
caddy reload
sudo systemctl reload caddy --caddy.service is not active, cannot reload.
Firewall status:
Status: active
To Action From
-- ------ ----
[ 1] 22000 ALLOW IN Anywhere
[ 2] 80,443/tcp ALLOW IN Anywhere
[ 3] 8080 ALLOW IN Anywhere
[ 4] 22786 (v6) ALLOW IN Anywhere (v6)
[ 5] 80,443/tcp (v6) ALLOW IN Anywhere (v6)
[ 6] 8080 (v6) ALLOW IN Anywhere (v6)

This appears to be a DNS issue.
Make sure your A record looks something like this
A 10.20.30.40
If your A record is formatted properly please update your question with the DNS record and your DNS provider (Cloudflare, Netlify, Godaddy, etc.)

Related

HAProxy breaks dav .well-known redirects in NextCloud

I have installed Nextcloud on a Homeserver tha5t also runs Plex. To rout connections from outside the network I am using HAProxy; it is correctly configured and works as expected.
In the process I had to change the Ports Nextcloud is Bind to with the following comand:
$ sudo snap set nextcloud ports.http=81 ports.https=444
which breaks the automatic rerouting for /.well-known/caldav and /.well-known/carddav and directly rerouts me to https://nextcloud.domain.com:444/remote.php/dav/ which is inaccessable outside the LocalHost.
Because NextCloud handles its own SSL, this approach could not work becaues HAProxy cannot detect /.well-known/caldav and /.well-known/carddav on the request address.
I have been looking for the correct HAProxy configuration in the case of NextCloud handeling SSL but with no success so far. so I have decided to try and allow the Port 444 through the Firewall with this comand $ sudo ufw allow from any to any port 444 proto tcp and forwarded it through my Router to the Server. Theoretically I should be able to access https://nextcloud.domain.com:444/remote.php/dav/ even from outside the network, but it only works on LocalHost. My thought is that (unless i forgot somthing) this Port is Blocked by the ISP and cannot be accessed from outside the Local Network. Now back to step 1 again to try and fix the redirecting problem:
Is there a way for HAProxy to catch /.well-known/caldav and /.well-known/carddav and do the correct redirecting to https://nextcloud.domain.com/remote.php/dav/ if NextCloud is handeling its own SSL?
OR
Is there a way to edit the Path NextCloud automatically redirects to?
instead of https://nextcloud.domain.com:444/remote.php/dav/ it should give https://nextcloud.domain.com/remote.php/dav/
the only way to fix this is to let HAProxy manage the SSL.. there is no other way

Google load balancer redirect IP address to specific port?

I'm using google compute engine, and have set up a load balancer over an instance group. I have also reserved an ip address. Everything works just fine, if I access the specific port (8080), but if I just try to access the ip-address I get a '404 error'. I have also added a domain and have the same problem. domain.com:8080 works but just domain.com gives a '404 error'.
Is the same host and path as this (host: *, path: /*) guy enough? Or is there more configuration to be done. I can't seem to find this information in the docs.
setup the load balancer frontend to listen to port 80 instead of 8080 and/or 443 for HTTPS (requires SSL certificate...)

Mikrotik direct ip to server on subnet

Please, advice on how to set the public IP address/domain name for a web page to be forwarded to a specific server machine on a subnet (say, 192.168.1.77). Can this be done via Mikrotik GUI interface?
An outside IP or assigned domain do not do this automatically, Mikrotik doesn't pick up the server behind a subnet if one does not set the path to it. I've seen a couple of tutorials assigning a server IP address in Mikrotik terminal with "masquerade" command but wonder if this can be done via Mikrotik Webfig GUI.
You need 2 things:
dst-nat to WEBserver
Default route on WEBserver set to Mikroitk
/ip firewall nat add chain=dstnat dst-address=PUBL.IC.I.P dst-port=80 or 443 action=dst-nat to-addresses=192.168.1.77
You must disbale /ip service www and www-ssl for using port 80 or 443
If Mikrotik isn't default route to internet for WEBserver say to me and I will explain how to do
For testing if it's working, you must test by other connectiont outside your LAN ( maybe smartphone without wifi)

postgresql-crunchy not in rhc port-forward list

I have installed Postgresql 9.3 on OpenShift with the cartridge available at github. The database is started.
I want to connect to it from PgAdmin-III on my local PC. I am supposed to forward ports with:
rhc port-forward <myapp>
Yet, the list of port forwarding does not contain a forwarding for my Postgresql database. Hence, I cannot configure PgAdmin-III with the local port used for forwarding.
C:\>rhc port-forward ligatures
Checking available ports ... done
Forwarding ports ...
Permission denied - bind(2) while forwarding port 8080. Trying local port 8081
Permission denied - bind(2) while forwarding port 8080. Trying local port 8081
Only one usage of each socket address (protocol/network address/port) is
normally permitted. - bind(2) while forwarding port 8081. Trying local port 8082
Permission denied - bind(2) while forwarding port 8080. Trying local port 8081
Only one usage of each socket address (protocol/network address/port) is
normally permitted. - bind(2) while forwarding port 8081. Trying local port 8082
Only one usage of each socket address (protocol/network address/port) is
normally permitted. - bind(2) while forwarding port 8082. Trying local port 8083
To connect to a service running on OpenShift, use the Local address
Service Local OpenShift
------- -------------- ---- -----------------
haproxy 127.0.0.1:8081 => 127.2.56.130:8080
haproxy 127.0.0.1:8082 => 127.2.56.131:8080
node 127.0.0.1:8083 => 127.2.56.129:8080
Press CTRL-C to terminate port forwarding
How do I get a port forwarding for my postgresql-crunchy database?
Update
I have opened an issue at Bugzilla Redhat.
Update II
Issue can be replicated by creating a simple scalable nodejs + crunchydb application at Openshift.
Looking at the manifest.yml file, it does not look like it is publishing it's list of ports correctly (https://github.com/CrunchyData/openshift-postgres-cartridge/blob/master/metadata/manifest.yml) under the "Publishes" section, which is missing, take a look at this manifest for the official postgresql cartridge and compare the Publishes sections (https://github.com/openshift/origin-server/blob/master/cartridges/openshift-origin-cartridge-postgresql/metadata/manifest.yml)
It also seems to be missing the "protocols" section, along with other important information.
It should also probably use more descriptive port names in the "Endpoints" section. I would recommend logging an issue on that github repo with the specifics of the problem you are encountering.
I was able to run the cartridge just now without any problems. I'll take this offline with the user and try to resolve the problem.

Hostname not resolving to IP WHM/cPanel

I moved my WHM/cPanel installation to a new server. After changing the nameserver IP's and then after a little while the domains to started pointing to the new server.
However the hostname doesn't resolve to an IP address.
/scripts/ipcheck --verbose
IMPORTANT: Do not ignore this email.
Your hostname (xxx.example.com) could not be resolved to an
IP address. This means that /etc/hosts is not set up correctly,
and/or there is no dns entry for xxx.example.com. Please be
sure that the contents of /etc/hosts are configured correctly, and
also that there is a correct 'A' entry for the domain in the zone
file.
Some or all of these problems can be caused by /etc/resolv.conf
being setup incorrectly. Please check that file if you believe
everything else is correct.
You may be able to automatically correct this problem by using the
'Add an A entry for your hostname' option under 'Dns Functions' in
your Web Host Manager.
I ran:
nano /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
XXX.XXX.XXX.XXX xxx.example.com xxx
I also check:
nano /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
Also:
nano /etc/nameserverips
XXX.XXX.XXX.XXX=ns1.example.com
XXX.XXX.XXX.XXX=ns2.example.com
I checked the "Add an A Entry for your hostname" in WHM:
Hostname | Server Main IP
xxx.example.com | XXX.XXX.XXX.XXX
I checked and rebuilt dnsconfig
/scripts/rebuildingdnsconfig
I am really not sure what else to check, i have rebooted the server. The domains pointing to the name servers work fine. THe problem i am having is i route all cpanel access and SSL configs for the emails through https://xxx.example.com because this has the SSL cert. I have compared the settings to the older server and they are the same except the IP address.
Centos 6.4
WHM 11.40.0 Build 19
XXX.XXX.XXX = Server IPs
xxx.example.com = hostname
Any help would be appreciated.
Solved this:
Go to WHM, "add an entry for your hostname" and just submit again.
Even though it was correct submitting it again worked. This fix came from cPanel support.
I know its an old post, but here are a few checkpoints in addition to above if someone might need help in future with similar issue:
1> Check the content of
/etc/wwwacct.conf
2> Investigate your hostname & NS for proper results
dig ns1.example.com
dig hostname.exmple.com
host ns1.example.com
host (HOST IP)
nslookup hostname.exmple.com
3) Make sure you have registered your hostname.example.com and ns1.example.com at your domain registrar and they are pointing to right IP.
4) Ensure that no firewall is blocking port UDP:53 and others essential ports.