location /motech { alias /srv/motech/webapps/motech; try_files $uri @motech; } location @motech { proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Proto https; proxy_pass http://127.0.0.1:9081; }