Created
September 26, 2014 02:30
-
-
Save tadyjp/c30c53d7a6975364f398 to your computer and use it in GitHub Desktop.
Nginx config for local development
This file contains hidden or 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
$ cat /usr/local/etc/nginx/conf.d/applications.conf | |
server { | |
set $app_code ""; | |
set $app_port ""; | |
set $rails_root ""; | |
listen 80; | |
listen 443 ssl; | |
server_name *.dev; | |
if ($host ~ rendezvous) { | |
set $app_code "rendezvous"; set $app_port "3102"; | |
} | |
if ($host ~ api) { | |
set $app_code "arubaito-v2"; set $app_port "3106"; | |
set $rails_root "/Users/tady/src/api/public"; | |
} | |
error_log /var/log/nginx/error.log info; | |
access_log /var/log/nginx/$app_code-access.log; | |
ssl_certificate /usr/local/etc/nginx/ssl/tady.crt; | |
ssl_certificate_key /usr/local/etc/nginx/ssl/tady.key; | |
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_redirect off; | |
client_max_body_size 50M; | |
root $rails_root; | |
# location ~* \.(html|css|js|ico|gif|jpe?g|png)(\?[0-9]+)?$ { | |
# root /Users/tady/src/$app_code/public; | |
# break; | |
# } | |
if (!-f $request_filename) { | |
proxy_pass http://127.0.0.1:$app_port; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment