HTTPS serves blank page, HTTP serves perfectly static page

Please use this template for troubleshooting questions.

**My issue: I have two static HTML directories, serving them on nginx via HTTP works nicely, but using Letsencrypt certificates the browser makes successfully an encrypted connection, but it seems the nginx webserver is not serving the files then.
**

— BLOCK 1: HTTP (Port 80) —

server {
listen 80;
server_name kor.at www.kor.at;

location /gut { 
    alias "/var/www/gut/"; 
    index index.html; 
    autoindex on; 
} 

location /the { 
    alias "/var/www/the/"; 
    index index.html; 
    autoindex on; 
} 

# Optional: Redirect the ROOT (only) to HTTPS 
#location = / { 
#    return 301 https://$host$request_uri; 
#} 

}

— BLOCK 2: HTTPS (Port 443) —

server {
listen 443 ssl;
server_name kor.at www.kor.at;

ssl_certificate /etc/letsencrypt/live/kor.at/fullchain.pem; 
ssl_certificate_key /etc/letsencrypt/live/kor.at/privkey.pem; 
include /etc/letsencrypt/options-ssl-nginx.conf; 
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; 

location /gut { 
    alias "/var/www/gut/"; 
    index index.html; 
    autoindex on; 
    include /etc/nginx/mime.types; 
    # This fixes the blank page/123-byte issue over SSL 
    default_type text/html; 
} 

location /the { 
    alias "/var/www/the/"; 
    index index.html; 
    autoindex on; 
    include /etc/nginx/mime.types; 
    default_type text/html; 
} 

}

How I encountered the problem:
Trying to serve my webpages in HTTPS next to HTTP

Solutions I’ve tried:
All kinds of config options, but it seems the server is running in some fall-back case and serves some mangled html in HTTPS.

Version of NGINX or NGINX adjacent software (e.g. NGINX Gateway Fabric): 1.26.3 Raspberry Pi 4 4 GB Raspi OS 64-bit

No error log on this, as the server serves another blank page drop-in file instead.

1 Like

I found the error: I had a conflicting port forward for port 443, which redirected the 443 HTTPS requests to another machine with another small webserver running. Thus it seemed as if the web server on the nginx machine was responding, when actually the other web server was responding.

1 Like