I've concluded that @ptman is correct, and that support for mod_wsgi with ReviewBoard is specious at best. Fortunately, I discovered work-arounds for building mod_python under both 10.5 and 10.6, and on Intel and PowerPC. (The under-my-desk server I'm using is a G5 running 10.5.8, which is the best it'll ever get.)
Here is the bash script I developed to download, configure, build, and install mod_python
for Apache on OS X:
#! /bin/bash
cd ~/Downloads
curl -O http://archive.apache.org/dist/httpd/modpython/mod_python-3.3.1.tgz
tar xvzf mod_python-3.3.1.tgz
cd mod_python-3.3.1
# Detect kernel version (OS X 10.5.x is "9.x.0", OS X 10.6.x is "10.x.0", etc.)
if [ `uname -r | cut -d . -f 1` -ge 10 ]; then
echo "*** Code change to compile on 10.6+"
cp src/connobject.c src/connobject.c.orig
sed 's/APR_BRIGADE_SENTINEL(b)/APR_BRIGADE_SENTINEL(bb)/g' src/connobject.c.orig > src/connobject.c
diff -u src/connobject.c.orig src/connobject.c
echo
fi
./configure
# See http://mike.crute.org/blog/mod_python-on-leopard for Makefile changes.
# On a G5 we have to explicitly build ppc64 or Apache won't load the module.
cp src/Makefile src/Makefile.orig
if [ `arch` == "ppc" ]; then
sed -e 's/^(LDFLAGS=.*)$/\1 -arch ppc -arch ppc64/g' \
-e 's/^(CFLAGS=.*)$/\1 -arch ppc -arch ppc64/g' \
-e 's/(\$\(APXS\) \$\(INCLUDES\) -c)/\1 -Wc,"-arch ppc" -Wc,"-arch ppc64"/g' \
-E src/Makefile.orig > src/Makefile
else
sed -e 's/^(LDFLAGS=.*)$/\1 -arch i386 -arch x86_64/g' \
-e 's/^(CFLAGS=.*)$/\1 -arch i386 -arch x86_64/g' \
-e 's/(\$\(APXS\) \$\(INCLUDES\) -c)/\1 -Wc,"-arch i386" -Wc,"-arch x86_64"/g' \
-E src/Makefile.orig > src/Makefile
fi
make
sudo make install
sudo apxs -e -a -n 'python' mod_python.la
With this done — and with ReviewBoard and all its dependencies installed — I created a site within my server root directory and configured it to use mod_python:
rb-site install /Library/WebServer/Documents/reviewboard
Here is my conf/apache-modpython.conf
to host my ReviewBoard site at a sub-path of my existing server:
<Location "/reviewboard/">
PythonPath "['/Library/WebServer/Documents/reviewboard/conf'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings
SetEnv PYTHON_EGG_CACHE "/Library/WebServer/Documents/reviewboard/tmp/egg_cache"
SetEnv HOME "/Library/WebServer/Documents/reviewboard/data"
SetHandler mod_python
PythonHandler django.core.handlers.modpython
PythonAutoReload Off
PythonDebug Off
# Used to run multiple mod_python sites in the same apache
PythonInterpreter reviewboard_reviewboard
</Location>
<Location "/reviewboard/media">
SetHandler None
</Location>
Alias /reviewboard/media "/Library/WebServer/Documents/reviewboard/htdocs/media"
<Directory "/Library/WebServer/Documents/reviewboard/htdocs">
AllowOverride All
</Directory>
For convenience, I just symlinked it from the appropriate Apache config directory:
sudo ln -s /Library/WebServer/Documents/reviewboard/conf/apache-modpython.conf \
/etc/apache2/other/reviewboard.conf
Hope this is helpful for someone else looking to do the same. Thanks for the push in the right direction, @ptman!
nginx's config regex is fussy about curly braces, but you can use them if you quote your regex...
rewrite "^/([a-zA-Z]{2})/certificate" https://mysite.com/$1/certificate ;
should work.
Best Answer
There has to be something like the following in the
uwsgi_params
file:These are the params passed to your application. I think you need to change the
request_uri
to $host in order to remove everything behind the hostname.You can also set this variable inside the virtual server config as well, it should overwrite it locally. Do this before
uwsgi_pass 127.0.0.1:9001;
.ALTERNATIVE METHOD Also, you can create a rewrite rule as the following:
and add it into the
location /
part, but I'm not sure this will work as expected.