Nodejs for processing js and Nginx for handling everything else
Posted
by
Kevin Parker
on Server Fault
See other posts from Server Fault
or by Kevin Parker
Published on 2012-11-14T12:38:20Z
Indexed on
2012/11/14
17:05 UTC
Read the original article
Hit count: 299
I am having a nodejs running on port 8000 and nginx on port 80 on same server.
I want Nginx to handle all the requests(image,css,etc) and forward js requests to nodejs server on port 8000.
Is it possible to achieve this. i have configured nginx as reverse proxy but its forwarding every request to nodejs but i want nginx to process all except js.
nginx/sites-enabled/default/
upstream nodejs {
server localhost:8000; #nodejs
}
location / {
proxy_pass http://192.168.2.21:8000;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
© Server Fault or respective owner