Scenario: you already have an app running at http://your.server.com/ and you want to run Sentry at http://your.server.com/sentry/
I spend a few hours banging my head against this, and finally got it to work. There may be a better way, but I couldn't find it.
Warning: hacky.
....
# if your main app's static media is served at _static, you're screwed
rewrite ^(/_static/)(.*)$ http://your.server.com/sentry/_static/$2 permanent;
location /sentry {
rewrite /sentry/(.*) /$1 break;
proxy_pass http://localhost:9000/sentry/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
....
....
SENTRY_URL_PREFIX = '/sentry'
FORCE_SCRIPT_NAME = '/sentry'
....
description "start sentry"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
chdir /path/to/sentry
exec sudo -i -u yourusername /path/to/sentry/env/bin/sentry start --config=/path/to/sentry/sentry.conf.py --debug >> /tmp/sentry.log 2>&1
I came here searching for the bonus and have configured the other things like you before.
I had to add an environment variable to /etc/init/sentry.conf like this
env SCRIPT_NAME=sentry
Works all ok!