# HTTPS server { listen 443 ssl; listen [::]:443 ssl; # Don't forget to set your domain name here server_name example.com; # You can generate SSL certificates for nginx using certbot ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # The api block location ^~ /api { # The path to your static file server alias "/data/file-server"; autoindex on; autoindex_format json; add_header Access-Control-Allow-Origin *; } # The MeowIndex web app block location ^~ / { alias /etc/nginx/MeowIndex/dist; # Use sub_filter to configure the app sub_filter_types application/javascript; sub_filter_once on; sub_filter "{HOST-PLACEHOLDER}" "/api"; # Serve index.html on other 404 paths as well try_files $uri $uri/ /index.html; } } # Redirect HTTP to HTTPS server { listen 80 default_server; listen [::]:80 default_server; server_name default; return 302 https://$host$request_uri; }