Server will not resolve web page via DNS

Brought up a new server. Put Ubuntu 20 on it. I installed Apache and set up a virtual-host name. (I've done this before on other Linode servers. I (kinda) know what I'm doing.)

At set an A record at the registry (PairDomains) pointing to the new IP. It has propagated at least to the Google DNS 8.8.8.8.

If I key in just the IP 192.53.126.91 into the browser the index.html test page resolves.

If I enter the domain, k6anc.net I get a message "Can't connect to the server."

This my first time with Ubuntu 20. Did I screw something up? HELP!

Al

5 Replies

Your web server configuration is messed up or your firewall is blocking port 443. I'm betting on the latter…

stevewi:~ $ curl http://k6anc.net
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://k6anc.net/">here</a>.</p>
<hr>
<address>Apache/2.4.41 (Ubuntu) Server at k6anc.net Port 80</address>
</body></html>

stevewi:~ $ curl https://k6anc.net
curl: (7) Failed to connect to k6anc.net port 443: Connection refused

Whitespace added for clarity.

-- sw

I thought about that but here is how ufw is configured:

zzzzz:/var/www/html/k6anc.net$ sudo ufw status
[sudo] password for xxx: 
Status: active 
To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere                  
80                         ALLOW       Anywhere                  
443                        ALLOW       Anywhere                  
22/tcp (v6)                ALLOW       Anywhere (v6)             
80 (v6)                    ALLOW       Anywhere (v6)             
443 (v6)                  ALLOW       Anywhere (v6)


Also, entering an http:// (no s) should resolve?

I added "Apache Full" to this as well but nothing changed. I then disabled the ufw and nothing changed. I even rebooted the server? UFW is not active:

xxx@saturn:/var/www/html$ sudo ufw status verbose
[sudo] password for xxx: 
Status: inactive

Your DNS changes have propagated to at least Seattle, WA:

stevewi:~ $ dig k6anc.net

; <<>> DiG 9.10.6 <<>> k6anc.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41944
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;k6anc.net.            IN  A

;; ANSWER SECTION:
k6anc.net.        3285    IN  A   192.53.126.91

;; Query time: 30 msec
;; SERVER: 2607:f060:2::1#53(2607:f060:2::1)
;; WHEN: Mon May 03 17:43:38 PDT 2021
;; MSG SIZE  rcvd: 63

curl(1) fails on the IP address too:

stevewi:~ $ curl https://192.53.126.91
curl: (7) Failed to connect to 192.53.126.91 port 443: Connection refused

You might try this just for yucks:

sudo systemctl restart ufw

The next thing I would check is your SSL configuration in your web server…make sure your cert files are located where you told the web server they are.

-- sw

I got it to work!!! In the virtual-host record I took out this stuff:

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

RewriteEngine on
RewriteCond %{SERVER_NAME} =www.k6anc.net [OR]
RewriteCond %{SERVER_NAME} =k6anc.net
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

It works in my other domains but I think maybe I need to add an apache module for .htaccess to work… as this is what the above is for, from what I understand.

Thanks for your help.

@acanton77

Connection refused

This would indicate a service (Apache) not listening on port 443.

Ubuntu (via ufw) doesn’t respond to not-allowed ports so you would get a timeout if the port wasn’t allowed.

The fact @stevewi got a refusal suggests Apache wasn’t configured for port 443. The stuff you “took out” was the redirect from HTTP to HTTPS, so this wasn’t fixing the 443 problem, just stopping the server redirecting HTTP traffic to HTTPS.

However I can see this is now working (including HTTPS and the redirect) so I’m assuming you managed to get this configured successfully in the end. :)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct