nginx-config
# the IP(s) on which your node server is running. I chose port 3000.
upstream pinbox {
server 127.0.0.1:3000;
}
# the nginx server instance
server {
listen 0.0.0.0:80;
server_name pingbox.local pinbox;
access_log /var/log/nginx/pinbox.log;
chunkin on;
error_page 411 = @my_411_error;
location @my_411_error {
chunkin_resume;
}
# pass the request to the node.js server with the correct headers and much more can be added, see nginx config options
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://192.168.42.1:3000;
proxy_redirect off;
port_in_redirect off;
}
}