ubuntu16.04安装LAMP

1.安装Apache

sudo apt-get install apache2
  • 测试: 浏览器访问localhost,出现Apache2网页。

  • 查看状态:ervice apache2 status

  • 操作:service apache2 start/stop/restart

  • Web目录: /var/www/html

  • 安装目录: /etc/apache2/

  • 全局配置: /etc/apache2/apache2.conf

  • 监听端口: /etc/apache2/ports.conf

  • 虚拟主机: /etc/apache2/sites-enabled/000-default.conf

2.安装MySQL

sudo apt-get install mysql-server mysql-client
  • 测试:mysql -u root -p

  • 查看状态:service mysql status

  • 操作:service mysql start/stop/retart

  • 查看监听端口的情况:netstat -tunpl 或 netstat -tap

3.安装PHP

sudo apt-get install php7.0
  • 测试:php7.0 -v

4.安装其他模块

sudo apt-get install libapache2-mod-php7.0
sudo apt-get install php7.0-mysql
  • 重启服务
service apache2 restart

service mysql restart
  • 测试Apache能否解析PHP
sudo chmod 777 /var/www

vim /var/www/html/phpinfo.php

5.安装phpMyAdmin

sudo apt-get install phpmyadmin
  • 安装:选择apache2,点击确定。下一步选择是要配置数据库,并输入密码。

  • 创建phpMyAdmin快捷方式:sudo ln -s /usr/share/phpmyadmin /var/www/html

  • 启用Apache mod_rewrite模块:sudo a2enmod rewrite

  • 重启服务:

service php7.0-fpm restart

service apache2 restart

6.配置Apache

vim /etc/apache2/apache2.conf
  • 添加:
AddType application/x-httpd-php .php .htm .html

AddDefaultCharset UTF-8
  • 重启Apache服务
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值