Created
October 7, 2013 06:53
-
-
Save jdcantrell/6863519 to your computer and use it in GitHub Desktop.
This is part of my solution to replicate pow(ruby script)/anvil(osx app) on linux. You can symlink folders to ~/.sites/blarg and then view content in the browser by going to blarg.dev. If you're using ruby or python you can also startup an app server(unicorn/gunicorn/others) listening to 8080. I use dnsmasq to send all *.dev domains to localhost.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream app_server { | |
server localhost:8080 fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name "~^(?<base_dir>.+)\.dev$"; | |
access_log /var/log/nginx/dev.access.log main; | |
error_log /var/log/nginx/dev.error.log; | |
location / { | |
root /home/jd/.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