From the course: Advanced Express
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Running behind a web server
- [Instructor] Usually we don't want Node.js to directly serve a website. Things like SSL or TLS encryption are doable, but a web server was exactly made for such a task. That's why the most common setup is running Express Apps behind some reverse proxy like Nginx. On my EC2 instance, I've already installed Engine X and I used Let's Encrypt to install and setup a free SSL certificate. I've also already took care of the proxy configuration. Let's look into it real quick. So I'm going into /etc/nginx/sites-enabled/default, and there now see this section with location /. So the most important part is the proxy_pass directive here. This tells Nginx to reverse proxy everything to localhost on port 3000. For complete overview of all the proxy directives, please refer to the Nginx documentation. To let Express run behind the proxy properly, we also have to make a few adoptions to the code. So I had backed individual studio code, and in app.js I will now make a few adjustments. First of all I…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Tuning Express performance: NODE_ENV and compression4m 6s
-
(Locked)
Tuning Express performance: Further measures2m 2s
-
(Locked)
Add logging5m 3s
-
(Locked)
Using the Node.js cluster module5m 12s
-
(Locked)
Securing an Express application2m 44s
-
(Locked)
Deployment and operation with PM24m 37s
-
(Locked)
Running behind a web server5m 8s
-
(Locked)
-