mongoDB uses rockMongo for graphical management (with related configuration and detailed process of Nginx)

mongoDB uses rockMongo for graphical management (with related configuration and detailed process of Nginx)

1, Background
As we all know, mongoDB is a NoSql database, which is mainly used to store document types and cold data. Usually, when we do the CURD of mongo, we operate in a small black window, as shown below.

Therefore, today we use WEB server (nginx in this paper) and rockMongo to manage mongoDB visually, and farewell to the small black window ~ ~ after realizing the visual configuration, the main interface is as shown in the figure below.

2, Environmental preparation
nginx (script used to configure PHP), rockMongo, mongoDB database. This article is configured in Windows operating system, the same with Linux operating system.

3, Start building

(1) Install nginx
It is very easy to install nginx under Windows. If you want to install nginx under SUSE Linux, please read my post

(2) Install mongoDB

#Database path
#Log output file path
#Error log in append mode
#Enable log files, enabled by default
#This option can filter out some useless log information. If you need to debug, please set it to false 
#Port number defaults to 27017
  • Install and start mongoDB services
    If an error is reported at startup, uninstall mongo's service and reinstall it
##Installation services
mongod --config D:\19_MongDB\mongodb-win32-x86_64-2008plus-ssl-3.4.16-26-g315d49ee78\mongo.conf --install --serviceName "MongoDB"
##Uninstall service
mongod --logpath "D:\19_MongDB\mongodb-win32-x86_64-2008plus-ssl-3.4.16-26-g315d49ee78\logs\mongo.log" --logappend --dbpath "D:\19_MongDB\mongodb-win32-x86_64-2008plus-ssl-3.4.16-26-g315d49ee78\data\db" --directoryperdb --serviceName "MongoDB" --serviceDisplayName "MongoDB" --remove
##Start service
net start MongoDB
##Out of Service
net stop MongoDB

(3) Download and configure rockMongo (play)
The following is the zip package of rockmongo for windows, which is permanent
Extraction code: rinc
Note: you can use the internal integrated environment of zip package for installation; you can also install by yourself. Since I configured ningx before, I installed it myself

  • First, copy the php and web directories under the rockmongo on Windows folder to the personal nginx directory

  • modify nginx.conf Document content
    In the server module, add the configuration of PHP and the configuration of accessing the rockMongo Homepage
    php configuration
 #pass the PHP scripts to FastCGI server listening on
         location ~ \.php$ {         
            #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

            ##To configure the parameters of php script, nginx needs to add modules
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME web/$fastcgi_script_name;
            include        fastcgi_params;

Visit the configuration of rockMongo Homepage

#Domain name access to rockMongo
        location /rockMongo {            
            #Static resource rockMongo address
             root ../web;
            index  index.html index.htm index.php;
  • Configuring bat scripts for start and stop
    In the installation directory of nginx, configure rockstart.bat And rockstop.bat
  • rockstart.bat Content of (note the relative path of the file)
@echo off

set ROCK_PHP_PATH=%~dp0\php
set ROCK_PHP_PORT=9000
set ROCK_NGINX_PATH=%~dp0\nginx-1.16.1

echo Starting nginx ...
bin\hstart "%ROCK_NGINX_PATH%\nginx.exe -p %ROCK_NGINX_PATH%"

echo Starting php-cgi ...
bin\hstart /NOCONSOLE "%ROCK_PHP_PATH%\php-cgi.exe -b -c %ROCK_PHP_PATH%\php.ini"

echo Success!


  • rockstop.bat Content of
@echo off

taskkill /f /IM nginx.exe
taskkill /f /IM php-cgi.exe


(4) Verification
After configuration, double-click rockstop.bat Stop the service and double click rockstart.bat . l if the browser accesses localhost/rockMongo, the login page of dockMongo will appear.

Tags: MongoDB Nginx PHP SSL

Posted on Sat, 20 Jun 2020 23:19:23 -0400 by exponder