ubuntu安装LAMP

1.安装LAMP
在终端中输入:
sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server
在运行中会提示设置mysql的root密码.

然后打开浏览器输入:http://localhost就可以看到
It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.
安装成功.

2.安装php扩展
安装curl扩展
sudo apt-get install php5-curl
安装gd
sudo apt-get install php5-gd
….基本上都一样,记住安装完后重启apache.
3.开启apache模块

开启mod_rewrite模块
sudo a2enmod rewrite
…其他的模块基本类似

4.添加虚拟主机
到/etc/apache2/sites-available目录下新建doc文件
文件内容为:
ServerName doc.local
DocumentRoot "/var/www/doc/"
ErrorLog "/var/log/apache2/doc_errors.log"
CustomLog "/var/log/apache2/doc_accesses.log" common
然后在终端运行
sudo a2ensite doc
sudo /etc/init.d/apache2 reload
在/etc/hosts中添加
127.0.0.1 doc.local
然后在浏览器中访问http://doc.local

如果提示没有权限 请修改doc目录的权限


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值