I'm trying to serve my Angular website over SSL with Nginx. The website works fine on port 80, but when I enable SSL on port 443, all I get is a white screen, and the website doesn’t lo
Here is my current setup:
user nobody;worker_processes 1;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; ### HTTP Server Block - Redirects all requests to HTTPS ### server { listen 80; listen 443 ssl; server_name “DomainName“ www.“DomainName“.com; ssl_certificate /etc/letsencrypt/live/“DomainName“/fullchain.crt; ssl_certificate_key /etc/letsencrypt/live/“DomainName“/privkey.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { root /usr/share/nginx/html; index index.html index.htm; } }}
Dockerfile
# Stage 1: Build the Angular appFROM node:18-alpine AS buildWORKDIR /appCOPY package*.json ./RUN npm installCOPY . .RUN npm run build --prod# Stage 2: Serve with NginxFROM nginx:alpineCOPY ssl/fullchain.crt /etc/letsencrypt/live/domainname.com/fullchain.crtCOPY ssl/privkey.key /etc/letsencrypt/live/domainname.com/privkey.keyRUN chmod 700 /etc/letsencrypt/live/domainname.com/COPY nginx.conf /etc/nginx/nginx.confCOPY --from=build /app/dist/portfolio /usr/share/nginx/htmlEXPOSE 80
roblem Description:
The site works without issues over HTTP (port 80).When I enable HTTPS (port 443), I only get a whiteI have combined the HTTP and HTTPS configuration in one server block, as described here:https://nginx.org/en/docs/http/configuring_https_servers.html
Does anyone have an idea of what might be causing this?I’d appreciate any help!