Ubuntu 搭建LAMP环境

554 查看

1、Apache

安装:

sudo apt-get install apache2

启动:

sudo service apache2 start

如果启动Apache时出现:

Could not reliably determine the server's fully qualified domain name, using 10.174.228.227. Set the 'ServerName' directive globally to suppress this message

解决方案:

vim  /etc/apache2/apache2.conf

加上 ServerName 127.0.0.1

测试:

2、MySQL

安装:

sudo apt-get install mysql-server

测试:

3、PHP

安装:

sudo apt-get install php5

测试:

4、PHP扩展安装

mysql,gd,curl

5、MySQL配置远程连接权限

修改 /etc/mysql/my.conf
注释 #bind-address = 127.0.0.1
Sql代码

mysql>    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; 

执行完后,再

mysql>    flush privileges; 

刷新一下权限就可以了,不用重启

6、Apache2 多站点配置

cd /etc/apache2
vim ports.conf            添加要监听的端口号
cd sites-available
cp 000--default.conf  fileName.conf    复制配置文件
vim fileName.conf            修改配置文件