Skip to content

Instantly share code, notes, and snippets.

@stack72
Last active August 29, 2015 14:10
Show Gist options
  • Save stack72/d4d7bed1aad8dd639f8d to your computer and use it in GitHub Desktop.
Save stack72/d4d7bed1aad8dd639f8d to your computer and use it in GitHub Desktop.
file { '/etc/nginx/sites-available/default':
ensure => file,
mode => '0755',
content => template('roles/nodejs-sample.erb')
}
/roles/templates/nodejs-sample.erb
upstream nodejs-sample {
server 127.0.0.1:5000;
}
# the nginx server instance
server {
listen 0.0.0.0:80;
server_name testapp;
access_log /var/log/nginx/testapp.log;
# 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-NginX-Proxy true;
proxy_pass http://172.16.1.2:5000/;
proxy_redirect off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment