1: 安装mysql

apt-get install mysql-server mysql-client

安装过程中会被问到设置mysql root的密码

    New password for the MySQL "root" user: <-- yourrootsqlpassword

    Repeat password for the MySQL "root" user: <-- yourrootsqlpassword

2: 安装apache2

apt-get install apache2-mpm-worker

在ubuntu上,Apache的默认document root目录是/var/www,配置文件是/etc/apache2/apache2.conf. 一些附加的文件存在/etc/apache2的子目录中。就像/etc/apache2/mods-enabled是存储Apache modules配置信息的, /etc/apache2/sites-enabled 是存储站点配置信息的,/etc/apache2/conf.d是标准的存储扩展文件的目录,你可以只用这个目录存储附加配置文件。

3:安装php5

apt-get install libapache2-mod-fastcgi php5-fpm php5

php-fpm 是一个守护进程,自启动脚本是/etc/init.d/php5-fpm,它运行一个FastCGI server在9000端口上.

安装完毕后执行下列命令

a2enmod actions fastcgi alias

会看到诸如下列内容

Enabling module actions.

Module fastcgi already enabled

Module alias already enabled

To activate the new configuration, you need to run:

  service apache2 restart

这时根据提示,可以运行service apache2 restart,或者 /etc/init.d/apache2 restart 当然你也可以等下面修改完配置文件后再进行重启。

4:配置Apache

vi /etc/apache2/conf.d/php5-fpm.conf

<IfModule mod_fastcgi.c>

AddHandler php5-fcgi .php

Action php5-fcgi /php5-fcgi

Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi

FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization

</IfModule>

这个是全局的配置,你还可以把这段信息只为你的特定站点进行配置,比如

vi /etc/apache2/sites-available/default,然后在某个你需要的

<VirtualHost></VirtualHost>之间加入它们。

关于这个配置更多的帮助信息参考

http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiExternalServer.

完成之后记得/etc/init.d/apache2 restart 重启使新的配置生效

5:测试你的站点

vi /var/www/info.php

加入如下信息

<?php

phpinfo();

现在我们可以访问下你的站点,就像我的测试站点http://192.168.0.100/info.php。

6:安装PHP对mysql的支持

你可以apt-cache search php5,在列表中查看你需要的支持包, 挑拣那些你需要的安装他们,如:

apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell

php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

安装好后,执行下

/etc/init.d/php5-fpm reload

/etc/init.d/apache2 reload

再访问下你的站点,就像我的测试站点http://192.168.0.100/info.php。新增加的这里应该都有了。

完毕!

ubuntu上安装apache2+mysql+php5-fpm(PHP5 - FastCGI Process Manager)的更多相关文章

  1. ubuntu上安装nginx+mysql+php5-fpm(PHP5 - FastCGI Process Manager)

    题外话:由于近段时间测试环境ssh链路质量不大好,经常短线.故我把整个安装过程放到screen里去执行,以防止断线中断了安装过程.执行screen -S install,这样断线后,只要再执行scre ...

  2. 在Ubuntu上安装 nginx, MySQL, PHP (LEMP),phpmyadmin和WordPress

    0)更新 Apt-Get 终端命令:sudo apt-get update 1) 安装php sudo apt-get install php5 2)安装MySql 终端命令: sudo apt-ge ...

  3. 在Ubuntu上安装Redis MySQL MongoDB memcached Nginx

    1.安装Redis sudo apt-get install redis-server 2.安装MySQL sudo apt-get install mysql-server 3.安装MongoDB ...

  4. 使用PPA在Ubuntu上安装php5.4~5.6,7

    使用PPA在Ubuntu上安装php5.4~5.6,7 sudo apt-get install software-properties-common sudo add-apt-repository ...

  5. ubuntu上安装mysql 编译安装

    为什么要折腾?首先说明的是ubuntu上安装mysql等软件是非常容易简单的,其简单的程度盖过windows上的安装,一句sudo apt-get install就可以搞定.如果想用最简便的方法安装m ...

  6. Ubuntu上安装MySQL

    Ubuntu上安装MySQL非常简单只需要几条命令就可以完成.`````` sudo apt-get update sudo apt-get install mysql-server 会弹出提示,让输 ...

  7. ubuntu上安装 MySQL 启动/停止 连接MySQL

    1.Ubuntu上安装MySQL服务   1.安装服务端   sudo apt-get install mysql-server    2.安装客户端   sudo apt-get install m ...

  8. ubuntu上安装mysql及导入导出

    ubuntu上安装mysql:  1. sudo apt-get install mysql-server 2. apt-get isntall mysql-client3. sudo apt-get ...

  9. LEMP--如何在Ubuntu上安装Linux、Nginx、MySQL和PHP

    简介 LEMP是用来搭建动态网站的一组软件,首字母缩写分别表示Linux.Nginx(Engine-X).MySQL和PHP. 本文将讲述如何在Ubuntu安装LEMP套件.当然,首先要安装Ubunt ...

随机推荐

  1. Analog/digital converter (ADC)

    1.ADC1 and ADC2 are 10-bit successive approximation Anolog to Digital Converters. 所谓successive appro ...

  2. rest api get 查询接口 多个参数

    查询时,使用get,传递参数至服务器. angular js中,$http可以直接传递object,在get中,params:data 在服务端, query(x=x,y=y)可写成 query(** ...

  3. PHPUnit-函数依赖-数据提供-异常-忽略-自动生成

    1. 本文目的 本文目的是收录一些PHPUnit的有用技巧,这些技巧能够为给PHPUnit单元测试带来很多便利.本文将要介绍的技巧如下: 函数依赖测试 数据提供函数 异常测试 跳过忽略测试 自动生成测 ...

  4. js数值使用及数组转json,转化后的json传入后台解析

    var storeArray=new Array(); $("input[name='storeid']").each(function(i){ var curStoreObj = ...

  5. IP地址分类百科

    IP地址分类介绍 这里讨论IPv4,IP地址分成了A类.B类.C类.C类.E类,如下图所示: 解释: A类以0开头,网络地址有7位,主机地址有24位,举例:A类地址:0 10000000 000000 ...

  6. java底层学习---1

    JRE: Java Runtime EnvironmentJDK:Java Development Kit JRE顾名思义是java运行时环境,包含了java虚拟机,java基础类库.是使用java语 ...

  7. Mathematica学习笔记2

    导入文件中的矩阵 mat = Import["...", "Table"] 转化为向量矩阵(元素为数对) data = Table[{mat[[i, j]], ...

  8. [转]ubuntu搭建LAMP环境

    首先下载安装apache2 输入:sudo apt-get install apache2 安装完毕后,在浏览器中输入:localhost 可以看到apache的默认主页 紧接着安装php5 输入:s ...

  9. 002.Create a web API with ASP.NET Core MVC and Visual Studio for Windows -- 【在windows上用vs与asp.net core mvc 创建一个 web api 程序】

    Create a web API with ASP.NET Core MVC and Visual Studio for Windows 在windows上用vs与asp.net core mvc 创 ...

  10. ASP.NET Core MVC 控制器创建与依赖注入

    本文翻译自<Controller activation and dependency injection in ASP.NET Core MVC>,由于水平有限,故无法保证翻译完全准确,欢 ...