Monday, June 23, 2014

Node.js + nginx: not so simple, but very awesome

Al last!! I've configured node.js + nginx, it was a bit hard to understand the concept of upstream, but now I get it, and it's awesome!!!

First, I've configured the upstream for the reverse proxy

upstream myapi {

Next, I've setup the server

location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://myapi;
        proxy_redirect off;

With that, I can bypass node request using nginx!!!

No comments: