오늘만살자

우분투 18.04 mongodb + php 7.2 + ngnix 본문

MongoDB

우분투 18.04 mongodb + php 7.2 + ngnix

오늘만살자 2018. 5. 31. 12:51


sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5


echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list



sudo apt update

sudo apt install -y mongodb-org


sudo systemctl stop mongod.service

sudo systemctl start mongod.service

sudo systemctl enable mongod.service


sudo systemctl status mongod


mongo --host 127.0.0.1:27017


> use admin

> db.createUser({user:"admin", pwd:"new_password_here", roles:[{role:"root", db:"admin"}]})




sudo apt-get install software-properties-common

sudo add-apt-repository ppa:ondrej/php


sudo apt install php7.2-fpm php7.2-common  php-pear php7.2-dev


cd /tmp

git clone https://github.com/mongodb/mongo-php-driver.git

cd mongo-php-driver

git submodule sync && git submodule update --init

phpize

./configure

make 

sudo make install


sudo echo "extension=mongodb.so" >> /etc/php/7.2/fpm/php.ini

sudo echo "extension=mongodb.so" >> /etc/php/7.2/cli/php.ini


sudo apt install nginx

sudo systemctl stop nginx.service
sudo systemctl start nginx.service
sudo systemctl enable nginx.service

sudo vi /etc/nginx/sites-available/default


server {
    listen 80;
    listen [::]:80;
    root /var/www/html;
    index  index.php index.html index.htm;
    server_name  example.com www.example.com;

    location / {
        try_files $uri $uri/ =404;       
    }

  
     # pass PHP scripts to FastCGI server
        #
        location ~ \.php$ {
               include snippets/fastcgi-php.conf;
        #       # With php-fpm (or other unix sockets):
               fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        }
}


sudo systemctl restart nginx.service
sudo systemctl restart php7.2-fpm.service


'MongoDB' 카테고리의 다른 글

uri 접속 방법  (0) 2020.03.16
데이타 import  (0) 2017.12.08
유저 접속  (0) 2017.12.08
우분투 서비스 등록  (0) 2017.12.07
우분투 16.04에 설치  (0) 2017.12.07
Comments