Http shows nginx page

AI-generated summary

The user pibodi encountered an issue after installing Discourse on a new VPS, where accessing the site via HTTP shows the default Nginx page, while HTTPS works correctly. During setup, they received warnings about port 80 and 443 being inaccessible, which was puzzling since no other Nginx or Apache was installed. After editing app.yml and running discourse-doctor, the site became functional over HTTPS. The user noticed that during the rebuild, Nginx configuration was updated to redirect HTTP to HTTPS, suggesting the issue might have been due to DNS propagation or a temporary misconfiguration. pfaffman suspects DNS lag or a previous server configuration might have caused the default Nginx page to appear, but no definitive solution is provided.

Hello! I’ve done the installation from zero.
It was a bit strange, because when I tried ./discourse-setup, I’ve got

Hostname for your Discourse? [oreillefine.art]: 

Checking your domain name . . .
WARNING: Port 443 of computer does not appear to be accessible using hostname:  oreillefine.art.
WARNING: Connection to http://oreillefine.art (port 80) also fails.

Then I manually edited app.yml to add smtp settings and let’s encrypt mail, as well as templates for https usage.

Then I’ve tried ./discourse-doctor and everything worked! I was able to see the new website. But… now I am confused: if I am trying to access my site via http (http://oreillefine.art), I am seeing nginx default page, while https works normally (https://oreillefine.art), and I can see Discourse… many thanks in advance for any help!

I suspect that you got that error because you have some otherr NGINX on your machine that’s keeping Discourse from accessing it.

I don’t understand how it managed to get a cert if that’s the case, though.

I am sure I don’t have any other nginx, it’s a new vps and I didn’t install nginx or apache before… as for different content of http and https, could you suggest any solution?

Hmm. That’s very strange. I have no explanation or recommendations.

probably I can give you some log files?

I saw this during rebuild:

listen 80;
  return 301 https://$$ENV_DISCOURSE_HOSTNAME$request_uri;
}
server {
 in /etc/nginx/conf.d/discourse.conf
I, [2024-05-10T12:24:54.676331 #1]  INFO -- : Replacing (?m-ix:listen 80;\s+gzip on;) with listen 443 ssl http2;
SSL_TEMPLATE_SSL_BLOCK
 in /etc/nginx/conf.d/discourse.conf
I, [2024-05-10T12:24:54.677081 #1]  INFO -- : Replacing (?m-ix:listen 80;\s+listen \[::\]:80;\s+gzip on;) with listen 443 ssl http2;
listen [::]:443 ssl http2;
SSL_TEMPLATE_SSL_BLOCK
 in /etc/nginx/conf.d/discourse.conf
I, [2024-05-10T12:24:54.677779 #1]  INFO -- : Replacing (?-mix:SSL_TEMPLATE_SSL_BLOCK) with 
ssl_protocols TLSv1.2 TLSv1.3;

It looks like it’s redirecting as expected now.

My best guess is that a DNS lag and the hostname used to point to some other server that was running an unconfigured NGINX server.