First time here? Check out the FAQ!
1

serve askbot on nginx with uwsgi or gunicorn from subpath

Has anyone successfully served askbot from a subpath using nginx with uwsgi or gunicorn.

Main site: www.example.com Will have link to askbot forum: www.example.com/ask

On nginx trying to capture this seperately by doing

location /ask/ {
    proxy_set_header    X-Real-IP   $remote_addr;
    proxy_set_header    Host        $http_host;
    proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;

    rewrite ^/ask/(.*)$ /$1 break;
    proxy_pass http://askbot;  #askbot is an upstream hook either gunicorn or uwsgi
    proxy_redirect http://askbot/ $scheme://$host/ask/;

No success. Tried other approaches, uwsgi SCRIPT_NAME cofiguration, etc... The closet one found was using nginx as a proxy and serving askbot from apache. Obviously, I'd like to have just nginx running and not have both apache and nginx running.

Why run from a subpath. Simple the main site will have links to other facets of the website. I don't it to be incorporated into the main site which are either django projects or other framework. Bottom line: it would be nice to be able to deploy separate from non-root location.

asked 2012-07-22 13:02:31 -0500
This post is a wiki. Anyone with karma >100 is welcome to improve it.
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

Try using FORCE_SCRIPT_NAME valiable in the settings.py file. This commit in Django supposedly fixed the issue back in 2008.

There is a more hackish workaround described in this blog post and a stackoverflow answer.

updated 2012-07-22 13:47:47 -0500
This post is a wiki. Anyone with karma >100 is welcome to improve it.
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments