>  기사  >  데이터 베이스  >  VPS上搭建Nginx+PHP+MongoDB环境

VPS上搭建Nginx+PHP+MongoDB环境

WBOY
WBOY원래의
2016-06-07 16:28:001090검색

今天说搭建起来玩玩,还算顺利,把过程记录下来,方便以后查询。VPS装的是Ubuntu,是在DigitalOcean购买的,他有优势是什么?价格便宜,速度还行。(广告了) 1、Nginx 参考:https://www.digitalocean.com/community/articles/how-to-set-up-nginx-virtual-

今天说搭建起来玩玩,还算顺利,把过程记录下来,方便以后查询。VPS装的是Ubuntu,是在DigitalOcean购买的,他有优势是什么?价格便宜,速度还行。(广告了)

1、Nginx
参考:https://www.digitalocean.com/community/articles/how-to-set-up-nginx-virtual-hosts-server-blocks-on-ubuntu-12-04-lts–3

2、PHP 后半部分是装PHP
参考:https://www.digitalocean.com/community/articles/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04

3、MongoDB
参考:https://www.digitalocean.com/community/articles/how-to-install-mongodb-on-ubuntu-12-04

4、PHP的驱动
在http://pecl.php.net/package/mongo下载1.2.12(wget、axel等),然后执行如下命令:

  • tar zxf mongo-1.2.12.tgz
  • cd mongo-1.2.12
  • phpize5(可能需要先执行apt-get install php5-dev)
  • ./configure
  • make install(可能需要先执行apt-get install make)

在php.ini文件中增加extension=mongo.so(根据配置注意是否需要路径,我是直接加上路径的)

5、用phpinfo();查看结果

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.