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.

Answers


I run nginx to serve static AngularJS content. The backend functionality is served by NodeJS server that provides all necessary dynamic content and answers REST requests from the client-side. Nginx routes the dynamic queries to NodeJS, and serves static content directly. Both, client-side and server-side logic is written in the same language (JavaScript, or CoffeeScript).

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:


Any client-side framework like AngularJS isn't going to be bothered in the slightest by using just a vanilla Apache install, because it's pure client-side JavaScript.

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.


Need Your Help

SQL: Select dynamic column name based on variable

sql sql-server stored-procedures

I have a Microsoft SQL stored procedure whose column name I want to set via a variable that is passed into it:

Postgres default sort by id - worldship

postgresql ups-worldship

I need to setup worldship to pull from one of our postgres databases. I need to have it so that the packages are sorted by id. I have no way (that i am aware of) of having worldship send the order by