Heim  >  Artikel  >  Datenbank  >  VPS上搭建Nginx+PHP+MongoDB环境

VPS上搭建Nginx+PHP+MongoDB环境

WBOY
WBOYOriginal
2016-06-07 16:28:001090Durchsuche

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

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn