
上QQ阅读APP看书,第一时间看更新
How to do it...
Now that we have a very simple Express application, we'll place NGINX in front of it. Although Node.js is extremely fast, NGINX is not only faster but offers far more configurability. Even with WebSockets, we're still able to proxy this through NGINX. Let's take a look at the configuration:
server { listen 80; server_name express.nginxcookbook.com; access_log /var/log/nginx/express-access.log combined; location / { proxy_pass http://127.0.0.1:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }