debian部署lamp环境记录

2015-04-02

记录下安装lamp的过程。

1、安装apache2

apt-get install apache2

1.1、开启伪静态支持

a2enmod rewrite

1.2、配置虚拟机

创建目录
mkdir -p /var/www/xxx.com/public_html
mkdir /var/www/xxx.com/logs

vim /etc/apache2/sites-avaliable/xxxx.com.conf
添加:
<VirtualHost *:80>
ServerAdmin:xxxx@xxx.com 
ServerName:xxx.com //$_SERVER['SERVER_NAME"]
ServerAlias:www.xxx.com a.xxx.com //别名
DocumentRoot:/var/www/xxx.com/public_html/
ErrorLog:/var/www/xxx.com/logs/error.log
CustomLog:/var/www/xxx.com/logs/access.log combined
</VirtualHost>
1.3、启用虚拟主机

a2ensite xxx.com.conf
server apache2 reload

1.4、取消虚拟主机

a2dissite xxx.com.conf
2、安装mysql

apt-get install mysql-server
3、安装php5

apt-get install php5
3.1、安装php5的mysql支持

apt-get install php5-mysql
3.2、安装php5的mysqlnd以支持mysqli

apt-get install php5-mysqlnd
4、apache2重启

server apache2 restart

58 查看