First time here? Check out the FAQ!

Revision history  [back]

I got this working by using nginx as a front-end proxy. Here's my nginx config:

upstream askbot {
        server  localhost:9000;
}

upstream wiki {
        server  localhost:9001;
}

server {
        listen 80;
        server_name xxxxx.members.linode.com;

        proxy_redirect  off;
        proxy_set_header        Host    $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

        location ~ ^/ask {
                access_log      /var/log/nginx/askbot_log;
                root /opt/webapps/ask/;
                proxy_pass  http://askbot;
        }


        location / {
                access_log      /var/log/nginx/wiki_log;
                root /opt/webapps/wiki/;
                rewrite ^/wiki/(.*) /$1;
                proxy_pass  http://wiki;
        }
}

The other thing I had to do was update urls.py:

urlpatterns = patterns('',
    (r'%s' % settings.ASKBOT_URL, include('askbot.urls')),
    (r'^ask/admin/', include(admin.site.urls)),
    #(r'^cache/', include('keyedcache.urls')), - broken views disable for now
    (r'^ask/settings/', include('askbot.deps.livesettings.urls')),
    (r'^ask/robots.txt$', include('robots.urls')),
)

And, as you suggested, I removed the ASKBOT_MEDIA_URL setting.

For completeness, here's my apache config:

<VirtualHost localhost:9000>
     ServerAdmin xxxxxxxxx
     DocumentRoot /opt/webapps/ask/
     ServerName xxxxxxxx

     #aliases to serve static media directly
     #will probably need adjustment
     Alias /ask/m/ /usr/local/lib/python2.6/dist-packages/askbot-0.6.11-py2.6.egg/askbot/skins/
     Alias /ask/upfiles/ /opt/webapps/ask/askbot/upfiles/
     Alias /ask/admin/media/ /usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/

     <DirectoryMatch "/opt/webapps/ask/askbot/skins/([^/]+)/media">
        Order deny,allow
        Allow from all
     </DirectoryMatch>
     <Directory "/opt/webapps/ask/askbot/upfiles">
        Order deny,allow
        Allow from all
     </Directory>

     #must be a distinct name within your apache configuration
     WSGIDaemonProcess askbot2
     WSGIProcessGroup askbot2
     WSGIScriptAlias / /opt/webapps/ask/django.wsgi
     #make all admin stuff except media go through secure connection
     #<LocationMatch "/admin(?!/media)">
     #    RewriteEngine on
     #    RewriteRule /admin(.*)$ https://example.com/admin$1 [L,R=301]
     #</LocationMatch>
     CustomLog /var/log/apache2/askbot/access_log common
     ErrorLog /var/log/apache2/askbot/error_log
     LogLevel debug

</VirtualHost>

Thanks again for the support. :)

I got this working by using nginx as a front-end proxy. Here's my nginx config:

upstream askbot {
        server  localhost:9000;
}

upstream wiki {
        server  localhost:9001;
}

server {
        listen 80;
        server_name xxxxx.members.linode.com;

        proxy_redirect  off;
        proxy_set_header        Host    $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

        location ~ ^/ask {
                access_log      /var/log/nginx/askbot_log;
                root /opt/webapps/ask/;
                proxy_pass  http://askbot;
        }


        location / {
                access_log      /var/log/nginx/wiki_log;
                root /opt/webapps/wiki/;
                rewrite ^/wiki/(.*) /$1;
                proxy_pass  http://wiki;
        }
}

The other thing I had to do was update urls.py:

urlpatterns = patterns('',
    (r'%s' % settings.ASKBOT_URL, include('askbot.urls')),
    (r'^ask/admin/', include(admin.site.urls)),
    #(r'^cache/', include('keyedcache.urls')), - broken views disable for now
    (r'^ask/settings/', include('askbot.deps.livesettings.urls')),
    (r'^ask/robots.txt$', include('robots.urls')),
)

And, as you suggested, I removed the ASKBOT_MEDIA_URL setting.

For completeness, here's my apache config:

<VirtualHost localhost:9000>
     ServerAdmin xxxxxxxxx
     DocumentRoot /opt/webapps/ask/
     ServerName xxxxxxxx
aitia.org

     #aliases to serve static media directly
     #will probably need adjustment
     Alias /ask/m/ /usr/local/lib/python2.6/dist-packages/askbot-0.6.11-py2.6.egg/askbot/skins/
     Alias /ask/upfiles/ /opt/webapps/ask/askbot/upfiles/
     Alias /ask/admin/media/ /usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/

     <DirectoryMatch "/opt/webapps/ask/askbot/skins/([^/]+)/media">
        Order deny,allow
        Allow from all
     </DirectoryMatch>
     <Directory "/opt/webapps/ask/askbot/upfiles">
        Order deny,allow
        Allow from all
     </Directory>

     #must be a distinct name within your apache configuration
     WSGIDaemonProcess askbot2
     WSGIProcessGroup askbot2
     WSGIScriptAlias / /opt/webapps/ask/django.wsgi
     #make all admin stuff except media go through secure connection
     #<LocationMatch "/admin(?!/media)">
     #    RewriteEngine on
     #    RewriteRule /admin(.*)$ https://example.com/admin$1 [L,R=301]
     #</LocationMatch>
     CustomLog /var/log/apache2/askbot/access_log common
     ErrorLog /var/log/apache2/askbot/error_log
     LogLevel debug

</VirtualHost>

Thanks again for the support. :)