The best deployment architecture for angularjs nodejs app

后端 未结 3 1875
無奈伤痛
無奈伤痛 2021-02-07 15:56

I have Moto Adverts application in angularjs and nodejs. Angularjs-client-side is running on Apache HTTP Server (localhost:8000) but nodejs-server-side is runnning as node.js ht

3条回答
  •  执念已碎
    2021-02-07 16:45

    1. Node.js
    2. One server will be more maintainable. To optimize you can cache static files with nginx later if you need to. (Just search 'nginx Node.js static' but it will work fine without that if you have light traffic and not a ton of static files). I would not use Apache for anything.

    Here is a sample nginx config:

    server {
      listen 80;
      server_name myserver.net;
    
      root /mnt/app;
      index index.html index.htm;
    
      location /static/ {
           try_files $uri $uri/ =404;
      }
    
      location /api/ {
           proxy_pass http://127.0.0.1:8080;
      }
    }
    
    1. You won't need CORS with one.
    2. The ports will be the same so that isn't an issue.

提交回复
热议问题