ubuntu安装LAMP

来源:互联网 发布:淘宝网图片保护的网址 编辑:程序博客网 时间:2024/05/11 15:35
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.localDocumentRoot "/var/www/doc/"ErrorLog "/var/log/apache2/doc_errors.log"CustomLog "/var/log/apache2/doc_accesses.log" common
然后在终端运行
sudo a2ensite docsudo /etc/init.d/apache2 reload
在/etc/hosts中添加
127.0.0.1 doc.local
然后在浏览器中访问http://doc.local

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


原创粉丝点击