首页  >  文章  >  数据库  >  VPS上搭建Nginx+PHP+MongoDB环境

VPS上搭建Nginx+PHP+MongoDB环境

WBOY
WBOY原创
2016-06-07 16:28:001089浏览

今天说搭建起来玩玩,还算顺利,把过程记录下来,方便以后查询。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