Skip to content

Instantly share code, notes, and snippets.

@jdcantrell
Last active November 29, 2016 16:48
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jdcantrell/8028720 to your computer and use it in GitHub Desktop.
nginx config for having xip.io working with local dev
upstream xip_app_server {
server localhost:8080 fail_timeout=0;
}
server {
listen 80;
server_name "~^(?<base_dir>.+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.xip.io$";
access_log /var/log/nginx/xip.access.log main;
error_log /var/log/nginx/xip.error.log;
set $username "jd";
location / {
root /home/$username/.sites/$base_dir/;
index index.html index.htm;
try_files $uri/index.html $uri @app;
}
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment