Issues with deploying a nuxt static app


In my nuxt app I need environment variables at build-time (nuxt generate). Unfortunately they are not available. That’s the reason why I have to manually add the following deployment hook:

Title: “Copy .env to releasePath”
Command: cp {{ projectPath }}/.env {{ releasePath }}/.env


For nuxt static apps we need a fallback to 200.html (Nuxt - The generate Property)

Therefor we need to replace the line

try_files $uri $uri/ =404;

… with …

try_files $uri $uri/index.html /200.html;

… in NGINX config. Otherwise custom error pages or previews (!) won’t work.

location / {
    include cleavr-conf/*.conf.pre;
    # Insert this line
    try_files $uri $uri/index.html /200.html;
    # Remove this line
    # try_files $uri $uri/ =404;
    include cleavr-conf/*;

Both should work out of the box, but they don’t …