1

I want to know if it is possible to deploy Nuxt app on a shared hosting. After running npm run build --spa it generated below file structure in the dist directory, but don't know how to go from here.

nuxt dist

1
  • 3
    I think it is as simple as copying content of dist folder to your host. Then try yourdomain.com/server 🤷 Commented Oct 23, 2018 at 21:13

2 Answers 2

5

Here are some checklists to deploy your spa app on hosting.

  1. Did you configured your nuxt app as spa? You have to set your nuxt application spa mode in nuxt.config.js.

  2. Can you configure rewrite rule on your hosting? If you build your application via build --spa you need to configure rewrite rule that rewrite all request into index.html. This is sample configuration on Firebase Hosting.

    {
      "hosting": {
        "public": "dist",
        "ignore": [
           "firebase.json",
          "**/.*",
          "**/node_modules/**"
        ],
        "rewrites": [
          {
            "source": "**",
            "destination": "/index.html"
          }
        ]
      }
    }
    
  3. If you can't configure rewrite rule on your hosting, then you can build your application via generate.

All checklist passed, then just upload your dist directory on your hosting! That's all!

Sign up to request clarification or add additional context in comments.

Comments

0

Upload whats inside the build which is dist/ folder to public folder or from where the shared hosting domain points to after generating the pages.

If you're just gonna use it statically I suggest you better use some advanced static pages hosting with many benefits such as free ssl, CDN support, and push to deploy. e.g netlify.com, zeit.co/now .

This would only take you few minutes of learning and huge benefits in a lifetime.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.