Reference article: http://www.open-open.com/lib/view/open1330171884015.html
NGINX-GRIDFS Module installation and use
Project home: Https://github.com/mdirolf/nginx-gridfs
With Nginx-gridfs, you can directly use http to access Gridfs files in the.
1. Installation
Install various dependency packages: zlib ,Pcre , OpenSSL
In Ubuntu may be the following command:
sudo apt-get install Zlib1g-dev// seemssudo apt-get install Zlib-dev cannot be installed
sudo apt-get install libpcre3 Libpcre3-dev
sudo apt-get install OpenSSL Libssl-dev
Installation git (slightly)
Use git DownloadNginx-gridfs's Code:
git clone git://github.com/mdirolf/nginx-gridfs.git
CD Nginx-gridfs
Git submodule init
git submodule update
Download Nginx :
wget Http://nginx.org/download/nginx-1.0.12.zip
Tar zxvf nginx-1.0.12.zip
CD nginx-1.0.12
./configure--add-module= The path >
Make
sudo make install
If a compilation error occurs, the Configure when addedThe--with-cc-opt=-wno-error parameter.
2. Configuration Nginx
In Server in the configuration, add the following
location/pics/{
Gridfs Pics
Field=filename
type=string;
MONGO 127.0.0.1:27017;
}
The above configuration indicates:
Database is Pics , by file name filename to access the file, filename is of type string
Currently only supported through ID and the filename to access the file.
Start Nginx : /usr/local/nginx/sbin/nginx
Use Mongovue put a picture 001.jpg uploaded to Pics the database.
Open:/http Localhost/pics/001.jpg
If successful, you can see the picture displayed.
3. Nginx-gridfs Insufficient
does not implement HTTP for range support, which is the ability to continue the breakpoint and to download the Shard.
Above describes the installation and use of the Nginx-gridfs module, including aspects of the content, you want to be interested in PHP tutorial friends helpful.