ubuntu下apache2+php+msql安装配置

1. 安装mysql

    sudo apt-get install mysql-server

 

2. 安装apache2

    sudo apt-get intall apache2

 

3. 安装php5

    sudo apt-get install php5

    sudo apt-get install libapache2-mod-php5

    重启apache2

    sudo /etc/init.d/apache2 restart

 

    在/var/www/下编译test.php

    浏览器打开 http://localhost/test.php

 

4. 支持mysql

    sudo apt-get install libapache2-mod-auth-mysql
    sudo apt-get install php5-mysql

    重启apache2 
    sudo /etc/init.d/apache2 restart

 

5. 相关配置说明

    apache 的配置文件路径 /etc/apache2/apache2.conf
    php5路径 /etc/php5/apache2/php5.ini
    mysql配置文件 路径 /etc/mysql/my.cnf

   

    默认站点配置文件 /etc/apache2/sites-enabled/000-default,基本无须修改配置,就可以支持php;

    配置虚拟主机:

cd /etc/apache2/sites-available
cp default mytest

编辑mytest
<VirtualHost *:80>
    DocumentRoot /var/www/mytest
    ServerName mytest
其它不变

建立符号链接
ln -s mytest ../sites-enabled/mytest
sudo /etc/init.d/apache2 restart


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值