首頁  >  文章  >  資料庫  >  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