Install and use the nginx-gridfs module

Source: Internet
Author: User
: This article describes how to install and use the nginx-gridfs module. if you are interested in the PHP Tutorial, refer to it. Reference: http://www.open-open.com/lib/view/open1330171884015.html

Install and use the nginx-gridfs module

Project home: https://github.com/mdirolf/nginx-gridfs

Through nginx-gridfs, you can directly use http to access files in GridFS.

1. install

Install various dependent packages: zlib, pcre, and openssl

The following command may be used in ubuntu:

Sudo apt-get install zlib1g-dev // sudo apt-get install zlib-dev cannot be installed

Sudo apt-get install libpcre3 libpcre3-dev

Sudo apt-get install openssl libssl-dev

Install git (omitted)

Use git to download nginx-gridfs 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 =

Make

Sudo make install

If a compilation error occurs, add the -- with-cc-opt =-Wno-error parameter to configure.

2. Configure nginx

Add the following to the server configuration:

Location/pics /{

Gridfs pics

Field = filename

Type = string;

Mongo 127.0.0.1: 27017;

}

The configuration above indicates:

The database is pics and the file is accessed by filename. The filename type is string.

Currently, only files can be accessed by id and filename.

Start nginx:/usr/local/nginx/sbin/nginx

Upload an image 001.jpg to the pics database with unzip vue.

Open: http: // localhost/pics/001.jpg

If the image is successfully displayed, the image is displayed.

3. nginx-gridfs deficiency

Http range support is not implemented, that is, resumable data transfer and multipart download.


The above introduces the installation and use of the nginx-gridfs module, including some content, and hope to be helpful to friends who are interested in the PHP Tutorial.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.