Follow these steps to install ’s on OSX. Linux coming soon.
cd ~/src # your sources directory
mkdir nginx_gridfs && cd nginx_gridfs
git clone git://github.com/mdirolf/nginx-gridfs.git
wget http://sysoev.ru/nginx/nginx-0.7.62.tar.gz
tar -zxvf nginx-0.7.62.tar.gz
sudo port install boost pcre++ spidermonkey scons # macports!
cd nginx-0.7.62/
# i put mongodb at /mongodb - alter to fit your installation
export MONGO_INCLUDE_PATH=/mongodb/include/mongo/
export LIBMONGOCLIENT=/mongodb/lib/libmongoclient.a
export BOOST_INCLUDE_PATH=/opt/local/include/
export LIBBOOST_THREAD=/opt/local/lib/libboost_thread-mt.a
export LIBBOOST_FILESYSTEM=/opt/local/lib/libboost_filesystem-mt.a
export LIBBOOST_SYSTEM=/opt/local/lib/libboost_system-mt.a
./configure --add-module=/Users/sho/src/nginx_gridfs/nginx-gridfs
make
sudo make install
In nginx.conf:
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
location /gridfs/ {
gridfs;
gridfs_db database-name;
# these are the default values:
mongod_host 127.0.0.1:27017;
gridfs_root_collection fs;
}
# blah
}
You should now be able to start nginx using /usr/local/nginx/sbin/nginx
and navigate to 127.0.0.1/gridfs/#{file_name}.
UPDATE: for snow leopard, python is in /usr/bin, so you may need to symlink it like this for scons to find it:
$ sudo ln -s /usr/bin/python2.5 /opt/local/bin/python2.5
Also, nginx is updated to 0.8.30 now; these instructions work for the latest version too.
UPDATE 2: Currently the best version of this to use is , which simply pulls together a number of different patches to make a working version. Well, works for me, anyway!