concept nginx in category javascript

appears as: nginx
Node.js in Practice

This is an excerpt from Manning's book Node.js in Practice.

Though it’s possible to host Node applications behind other web servers like Apache and nginx, there are times when you’ll want to run your own HTTPS servers. This technique introduces the https module and shows how it’s related to the tls module.

Technique 97 Using Node with Apache and nginx

Deploying Node to private servers running Apache or nginx is entirely possible, and recommended for certain situations. This technique demonstrates how to run a Node program behind Apache and nginx.

Now that you know how Apache handles proxies, and how to keep a process running, let’s look at nginx. Nginx is often used as a web server, but it’s technically a reverse proxy server that supports HTTP, HTTPS, and email. To make nginx proxy connections to Node applications, you can use the Proxy module, which uses a proxy_pass directive in a way similar to Apache.

Listing 12.3 has the settings needed by nginx. Like Apache, you could also put the server block in a virtual host file.

Listing 12.3. Proxying requests to a Node application with nginx