File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # nginx.conf (copied to /etc/nginx/conf.d/default.conf in Dockerfile )
1+ # nginx.conf (to /etc/nginx/conf.d/default.conf)
22
3- # Redirect HTTP to HTTPS (optional):
3+ # 1) HTTP server: always enabled, fallback for testing
44server {
5- listen 80 ;
5+ listen 80 default_server ;
66 server_name _;
7- # If you strictly need HTTPS, uncomment the following line:
8- return 301 https://$host$request_uri ;
7+
8+ root /usr/share/nginx/html;
9+ index index .html;
10+
11+ # If real cert exists, redirect traffic to HTTPS
12+ if ( -f /etc/ssl /certs/ssl .crt) {
13+ return 301 https://$host$request_uri ;
14+ }
15+
16+ # SPA fallback
17+ location / {
18+ try_files $uri $uri / /index .html;
19+ }
920}
1021
11- # The main HTTPS server block:
22+ # 2) HTTPS server: only used when cert + key are present
23+ # (if those files are missing, this block is simply never reached)
1224server {
13- listen 443 ssl ;
25+ listen 443 ssl default_server ;
1426 server_name _;
1527
16- # Path to your SSL cert/key (matching the volumes you mount)
1728 ssl_certificate /etc/ssl /certs/ssl .crt;
1829 ssl_certificate_key /etc/ssl /private/ssl .key;
1930
20- # This should match where you COPY dist -> in Dockerfile
2131 root /usr/share/nginx/html;
2232 index index .html;
2333
24- # Typical SPA fallback
34+ # SPA fallback
2535 location / {
2636 try_files $uri $uri / /index .html;
2737 }
You can’t perform that action at this time.
0 commit comments