✓ Solved

HTTP not working but HTTPS is working.

Hi. I'm using Apache on Ubuntu 20.04. Accessing the server from HTTPS works (i.e. https://www.domain.com and https://domain.com), but HTTP does not work and returns "domain.com refused to connect" in Chrome. It also does not work in Firefox or Safari.

My server is listening to port 80 and 443. The UFW firewall allows ports 80, 443, http/tcp, and Apache Full. Doing "sudo ufw status" returns:

To Action From
-- ------ ----
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
25565 ALLOW Anywhere
3000 ALLOW Anywhere
80 ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)
25565 (v6) ALLOW Anywhere (v6)
3000 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)

I have separate virtual hosts in separate files for ports 80 and 443. The domains are set up properly with A and AAAA records for www and no www. The domains use the Linode nameservers. DNSChecker.org says it works. "curl --head http://www.domain.com" returns "HTTP/1.1 301 Moved Permanently […]
 Location: https://domain.com/". The .htaccess file is blank.

Doing "netstat -ltn" returns:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:33060 0.0.0.0:* LISTEN
tcp6 0 0 :::80 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 :::443 :::* LISTEN

I added an SSL certificate to the 443 port using LetsEncrypt. Before adding the SSL, HTTP worked. But now it does not. What the H is going on? Why isn't HTTP working?

2 Replies

✓ Best Answer

HTTP does not work and returns "domain.com refused to connect" in Chrome. It also does not work in Firefox or Safari.

Restart your server. Restart php-fpm if you use it. Clear your browser cache(s).

-- sw

Thank you Steve. Restarting the server worked.

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