Nginx connection to mongodb

Source: Internet
Author: User
: This article describes how to connect nginx to mongodb. For more information about PHP tutorials, see. 1) Download nginx-gridfs code

2) install the latest version of pcre

Download the latest pcre from https://sourceforge.net/projects/pcre/files/pcre/

# Unzip pcre-8.38.zip

# Cd pcre-8.38

#./Configure -- prefix =/usr/local/pcre-8.38 -- libdir =/usr/local/lib/pcre -- Export dedir =/usr/local/include/pcre

# Make & make install

3) install nginx

# Yum-y install gcc * openssl *

# Tar zxf nginx-1.7.7.tar.gz

# Cd nginx-1.7.7

#. /Configure -- prefix =/usr/local/nginx -- with-http_ssl_module -- with-http_stub_status_module -- with-http_flv_module -- with-http_gzip_static_module -- add-module =/usr/src/nginx-gridfs -- with-poll_module -- without-select_module -- with-http_realip_module -- -pcre =/usr/src/pcre-8.38

The source code file must be specified during compilation. Otherwise, an error will be reported during make:

/Bin/sh: line 2:./configure: No such file or directory
Make [1]: *** [/usr/local/pcre/Makefile] Error 127
Make [1]: Leaving directory '/usr/local/src/nginx-0.8.54 ′

Make: *** [build] Error 2

# Make & make install

4) Start nginx

#/Usr/local/nginx/sbin/nginx

# Ps-ef | grep nginx

# Netstat-nlp | grep nginx

# Curl http: // localhost

The welcome page is displayed. nginx is successfully set up.

5) Configure nginx

# Vim/usr/local/nginx/conf/nginx. conf

Location/pics /{

Gridfs pics root_collection = fs field = filename type = string-upics-ppics;

Mongo 127.0.0.1: 27017;

}

6) mongodb uploads images

# Program files put 1.jpg-d pics-t jpg-upics-ppics

# Program files list-d pics-upics-ppics

7) under curl

Curl http: // localhost/pics/1.jpg

The above describes how to connect nginx to mongodb, including some content, and hope to help those 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.