: 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.