Is it a common choice to deploy an AngularJS app to a vanilla Apache HTTP server?
I was curious about what kind of server an AngularJS app was usually deployed into, and Google didn't give a satisfactory answer. In particular, it looks to me that an AngularJS app is just a collection of static files, so is it common to just deploy such an app into a vanilla Apache HTTP server in production? Or is a light-weighted Node.js server preferred?
Thank you very much.
The biggest benefit of this is that we can load-balance client-side static content and backend content separately. It depends on the size of your app and demands that it makes regarding the dynamic content access.
Some other posts on the subject of deploying AngularJS:
- Do not run 'grunt server' in production: can grunt server use for production application deployment
- Run Apache/Nginx in production: Best way for deploy angular.js application made with yeoman?
- Hosting server/client side together: The best deployment architecture for angularjs nodejs app
That said, it's a rare single-page web app that doesn't have at least some interaction with the web server via AJAX in order to fetch and amend the data stored there, and that's where you may need to consider what server you should use carefully. Ultimately you can build your back end with whatever server-side technology you feel is most appropriate, be that PHP, Python, Ruby, Node or whatever, and your choice of server will be dictated more by that than by your choice of client-side framework.
I will add that I've often heard that Nginx is faster than Apache for serving static files, to the point that it's sometimes worth using Nginx for static files and reverse proxying to Apache for dynamic content. So it might make more sense to use Nginx than Apache for single page web apps. Personally I've used Nginx with Gunicorn for a Django app, and from what I've heard it's commonly used for both Ruby and Node.js applications as well. In the context of Node.js, I don't believe Node is generally used for serving static files in production, and from what I've heard the more usual arrangement is to have Nginx serve the static files and reverse proxy to the Node app for everything else.