Ask Your Question
1

serve askbot on nginx with uwsgi or gunicorn from subpath

asked 2012-07-22 13:02:31 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >100 is welcome to improve it.

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-07-22 13:47:47 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >100 is welcome to improve it.

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-07-22 13:02:31 -0500

Seen: 1,058 times

Last updated: Jul 22 '12