Ubuntu 安装LAMP
简要记录一下。
环境准备
虚拟机环境
lz@starnight:~$ sudo -i
[sudo] password for lz:
root@starnight:~# cat /etc/issue
Ubuntu 16.04. LTS \n \l
更新系统
root@starnight:~# sudo apt-get update
安装Apache
root@starnight:~# sudo apt-get install apache2
root@starnight:~# apache2 -v
Server version: Apache/2.4. (Ubuntu)
Server built: --18T14::
默认的Web路径:/var/www/html
root@starnight:/var/www/html# pwd
/var/www/html
root@starnight:/var/www/html# ls
index.html
访问本地地址:localhost或127.0.0.1

安装PHP
root@starnight:~# sudo apt-get install php7.
root@starnight:~# php7. -v
PHP 7.0.-0ubuntu0.16.04. (cli) ( NTS )
Copyright (c) - The PHP Group
Zend Engine v3.0.0, Copyright (c) - Zend Technologies
with Zend OPcache v7.0.28-0ubuntu0.16.04., Copyright (c) -, by Zend Technologies
root@starnight:~# sudo apt-get install libapache2-mod-php7.
安装MySQL
root@starnight:~# sudo apt-get install mysql-server
在安装过程中会提示输入/重复密码。
root@starnight:~# sudo apt-get install php7.-mysql
到这里LAMP环境就算是安装成功了。
虚拟目录
如果机器上要部署多个Web项目,可以通过不同端口进行指定。
例如:在Web Root下有个项目helo,我想直接通过ip:port的形式进行访问。
root@starnight:/var/www/html/helo# pwd
/var/www/html/helo
root@starnight:/var/www/html/helo# ls
index.php
这里可以通过配置虚拟目录来实现。
root@starnight:/var/www/html/helo# cat /etc/apache2/ports.conf
在Listen 80添加你想设置的端口,如8080
root@starnight:/var/www/html/helo# cat /etc/apache2/ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/-default.conf Listen
Listen
<IfModule ssl_module>
Listen
</IfModule> <IfModule mod_gnutls.c>
Listen
</IfModule> # vim: syntax=apache ts= sw= sts= sr noet
设置虚拟目录:
root@starnight:/var/www/html/helo# cat /etc/apache2/sites-available/-default.conf
copy 一份里面原有的内容,只需要更改port和DocumentRoot两项即可(本地环境,不涉及域名的问题,也可以进行相应的修改)

端口设置:8080,路径:/var/www/html/helo
重启apache2服务:
root@starnight:/var/www/html/helo# sudo /etc/init.d/apache2 restart
访问本地ip:port

对,index.php的内容就是那个经典的phpinfo()。
Ubuntu 安装LAMP的更多相关文章
- 2019.9.17更换ubuntu的镜像源 ubuntu安装lamp iis安装网站和ftp站
更换ubuntu的镜像源 /etc/apt/sources.list cp /etc/apt/sources.list /etc/apt/sources.list.bak 备份这个文件 vim / ...
- ubuntu 安装 lamp 和配置虚拟机
1:sudo passwd root #设定root密码 su 切换 exit 退出 ,或者 普通用户下 加sudo 2:sudo apt-get update #更新软件列表 3:sudo ...
- Ubuntu安装LAMP环境(PHP5.6) 以及下载安装phpmyadmin
参考路径: http://blog.nciaer.com/?p=133 修改apache(2.4.18)的web路径时, 需要将 /etc/apache2/sites-available/000def ...
- ubuntu 安装LAMP web 服务器, phpmyadmin 安装后无法打开解决
安装方法: http://blog.chinaunix.net/uid-26495963-id-3173291.html 在上述文档中需要增加apache 支持mysql 功能. apt-get in ...
- ubuntu安装LAMP环境
1. LAMP 的安装 sudo apt-get install apache2 mysql-server mysql-client php5 php5-gd php5-mysql 由于LAMP大部分 ...
- 笔记:Ubuntu安装LAMP环境
一.更换Ubuntu的镜像源 镜像源路径:/etc/apt/sources.list 备份:cp /etc/apt/sources.list /etc/apt/souces.list.bak 使用阿里 ...
- Ubuntu安装LAMP
1.安装apache2 sudo apt-get install apache2 sudo apt-get install apache2 Apache安装成功后,/var/www/默认作为web的根 ...
- ubuntu 安装 lamp
链接: http://www.cnblogs.com/CheeseZH/p/4694135.html
- ubuntu 安装 LAMP环境
http://jingyan.baidu.com/article/a681b0de36ad683b18434691.html
随机推荐
- LocalBroadcastManager—创建更高效、更安全的广播
前言 在写Android应用时候,有时候或多或少的需要运用广播来解决某些需求,我们知道广播有一个特性,就是使用sendBroadcast(intent);发送广播时,手机内所有注册了Broadcast ...
- ORACLE数据库 DBA常用知识
<常用命令参考> 个系统变量值 SQL> show user --显示当前连接用户 SQL> show error --显示错误 SQL> set heading off ...
- design principle:java 回调与委派/委托机制
博客 design principle:模拟 android Button 控件点击事件 主要说了一下模拟 android 的 Listener 模式,其实这就是一种委派与回调机制的体现. 委派,也可 ...
- Chapter 2 User Authentication, Authorization, and Security(6):服务器权限授予粒度
原文出处:http://blog.csdn.net/dba_huangzj/article/details/38867489,专题目录:http://blog.csdn.net/dba_huangzj ...
- Adapterview和adapter的联系
在J2EE中提供过一种非常好的框架--MVC框架,实现原理:数据模型M(Model)存放数据,利用控制器C(Controller)将数据显示在视图V(View)上.在Android中有这样一种高级控件 ...
- 【嵌入式开发】gcc 学习笔记(一) - 编译C程序 及 编译过程
一. C程序编译过程 编译过程简介 : C语言的源文件 编译成 可执行文件需要四个步骤, 预处理 (Preprocessing) 扩展宏, 编译 (compilation) 得到汇编语言, 汇编 (a ...
- (NO.00002)iOS游戏精灵战争雏形(三)
在Sprite中新建Sprites文件夹,在其中添加Player.cc文件,确保其类型为Sprite. 将其Root节点的CCSprite的精灵帧设置为Image/sprite-2.png,然后打开物 ...
- python的list
1.定义list >>> li = ["a", "b", "mpilgrim", "z", " ...
- Android使用Canvas实现跑马灯
网上的很多的教程都是通过更改TextView的属性进行跑马灯的设计.这样做有很多的缺点: 1.如果TextView没有获取焦点,那么跑马灯的效果无法实现. 2.如果文本长度小于TextView的宽度, ...
- Android不同系统版本依然能调用到正确的API方法Demo——Service调用startForeground举例
private static final Class<?>[] mSetForegroundSignature = new Class[] { boolean.class}; privat ...