1

Thanks for helping out!

I'm setting up an API server that will also function as a web-app server. (Debian 10)

I currently have nginx as a reverse proxy to my nodeJS app.

I'm thinking of using VueJS to develop my frontend single page app but I can't figure out how to tie it all together.

Should I :

  • use a reverse proxy to nodeJS and have my API live there
  • AND
  • use nginx to serve my vueJS web app, without the nodeJS overhead

This seems logical but I'm a bit confused, since I've never done it before.

Thanks again for helping! Regards, Renato

1
  • 1
    Should I - you likely should. You can run Node server for Vue development (Vue CLI start) but there's no use for it in production. At this point Vue app is a collection of static files that can be served by Nginx (unless you have universal Vue app like Nuxt). Commented Oct 13, 2020 at 15:39

1 Answer 1

1

I have a website running with nodejs and vuejs which is hosted on digital ocean with nginx reserve proxy. I'm using pm2 to call nodejs apis and it works perfectly fine. As far as Vue.js is concerned, you can run build and deploy the dist folder anywhere on the internet.

Just add the following code to run front-end with nginx:

server {
       
        root /path to your dist vuejs folder;

        index index.html index.htm index.nginx-debian.html;
        server_name domain.com;
        location / {
                try_files $uri $uri/ =404;
        }
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.