Skip to content

Instantly share code, notes, and snippets.

@pensierinmusica
Created August 8, 2013 07:03
Show Gist options
  • Save pensierinmusica/6182224 to your computer and use it in GitHub Desktop.
Save pensierinmusica/6182224 to your computer and use it in GitHub Desktop.
Nginx template configuration file for "sites-available"
## Subsitute text between ** with correct values
# the IP(s) on which your server is running.
upstream *nameforservice* {
server 127.0.0.1:*yourport* max_fails=0 fail_timeout=10s;
keepalive 512;
}
# the nginx server instance
server {
listen 80;
server_name *domain*;
client_max_body_size 16M;
keepalive_timeout 10;
# turn off all logging for performance improvement
access_log off;
error_log /dev/null crit;
# toggle comment with statements above to see logs
#access_log /var/log/nginx/*nameforservice*.log;
# pass the request to the 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://*nameforservice*/;
proxy_redirect off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment