0

I'm installing Reviewboard on linux, I have copied the config provided by the install package to httpd.conf

    <VirtualHost *:80>
    ServerName localhost
    DocumentRoot "/usr/www/reviewboard/htdocs"

    # Error handlers
    ErrorDocument 500 /errordocs/500.html

    WSGIPassAuthorization On
    WSGIScriptAlias "/reviewboard" "/usr/www/reviewboard/htdocs/reviewboard.wsgi/reviewboard"

    <Directory "/usr/www/reviewboard/htdocs">
            AllowOverride All
            Options -Indexes FollowSymLinks
            Allow from all
    </Directory>

    # Alias static media requests to filesystem
    Alias /reviewboard/media "/usr/www/reviewboard/htdocs/media"
    Alias /reviewboard/errordocs "/usr/www/reviewboard/htdocs/errordocs"
    Alias /reviewboard/favicon.ico "/usr/www/reviewboard/htdocs/media/rbcommons/images/favicon.png"
    </VirtualHost>

However, when I access "http://SITE/reviewboard/htdocs/reviewboard.wsgi", it just gives me the file in plain text instead of running the script

I have checked the mod_wsgi is running on apache2 by "apache2ctl -t -D DUMP_MODULES"

Did I miss any other configuration?

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134
Alvin
  • 149
  • 1
  • 10

1 Answers1

1

You should be using the URL:

http://SITE/reviewboard

and the WSGIScriptAlias directive should be:

WSGIScriptAlias "/reviewboard" "/usr/www/reviewboard/htdocs/reviewboard.wsgi"

Do be aware though that it is bad practice to be putting your whole Django site under DocumentRoot. That you are seeing the source code for the WSGI script file highlights why it is bad. That is, have an issue with your Apache configuration and you could expose all your source code for people to download. Especially bad if settings.py is in there and it contains database passwords.

Now, address those issues and update question with what you then have and what next problem is as I don't expect that to completely solve the problem because with those mistakes you should have got a different problem than what you describe, so suspect that your configuration is not even being used.

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134
  • Thanks a lot. I got it work now. I think `WSGIScriptAlias "/reviewboard" "/usr/www/reviewboard/htdocs/reviewboard.wsgi/reviewboard"` is fine. – Alvin Oct 29 '12 at 04:47
  • Btw, I think you have mentioned a good point. Do you mean I should just put the directory htdocs under the DocumentRoot? and leave other directories like log, conf, data and logs in another place like /etc/revieboard? But the user can still view reviewboard.wsgi in such way. How do I prevent this? – Alvin Oct 29 '12 at 04:52
  • Having that WSGIScriptAlias is not necessarily fine. Having the mount point repeated at the end of the target WSGI script has a very special meaning to Apache. So special and magical it isn't even documented on the mod_wsgi site and only explained to people in the specific cases where it is needed. If it works, then it can only mean that all your urls.py URLs are prefixed with 'reviewboard', else can't see how it could work. – Graham Dumpleton Oct 29 '12 at 09:08
  • As to DocumentRoot, simply do not stick any part of the whole Django project, associated configuration or data files under the directory specified by DocumentRoot. So long as you set up the separate directory containing just the WSGI script file with the correct Apache access permissions, everything should work without needing to be under DocumentRoot. I would perhaps suggest you review what is required for a simple hello world. http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide – Graham Dumpleton Oct 29 '12 at 09:13
  • Finally. If you have it working and it wasn't any of the suggested answers or was slightly different, it is always good practice to answer the question yourself with the correct answer so other people can learn, rather than guessing what you did to solve the problem. – Graham Dumpleton Oct 29 '12 at 09:15