环境搭建

参考:

http://blog.csdn.net/zph1234/article/details/51248124

http://www.jb51.net/os/188488.html

1、配置防火墙
CentOS 7.0默认使用的是firewall作为防火墙。
1、关闭firewall:

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动

2、关闭SELINUX

vi /etc/selinux/config
#SELINUX=enforcing #注释掉
SELINUX=disabled #增加
:wq! #保存退出
setenforce 0 #使配置立即生效
3.安装apache

yum install httpd #根据提示,输入Y安装即可成功安装
systemctl start httpd.service #启动apache
systemctl stop httpd.service #停止apache
systemctl restart httpd.service #重启apache
systemctl enable httpd.service #设置apache开机启动

4.安装mariadb(mysql)

yum install mariadb mariadb-server #询问是否要安装,输入Y即可自动安装,直到安装完成
systemctl start mariadb.service #启动MariaDB
systemctl stop mariadb.service #停止MariaDB
systemctl restart mariadb.service #重启MariaDB
systemctl enable mariadb.service #设置开机启动

修改mysql密码:set password for 'root'@'localhost'=password('root');

mysql授权远程连接(navicat等): grant all on *.* to root identified by 'root';

5、安装PHP以及组件,使PHP支持 MariaDB

yum install php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
#这里选择以上安装包进行安装,根据提示输入Y回车
systemctl restart mariadb.service #重启MariaDB
systemctl restart httpd.service #重启apache

测试
cd /var/www/html
vi index.php #输入下面内容
<?php
phpinfo();
?>
:wq! #保存退出
在客户端浏览器输入服务器IP地址,可以看到如下图所示相关的配置信息!

● 修改apache默认根目录:

vim /etc/httpd/conf/httpd.conf

将DocumentRoot “/var/www/html”改为:

DocumentRoot "/mnt/hgfs/CentOS7/www/www.laravel.com"

<Directory "/var/www/html">改为:

<Directory "/mnt/hgfs/CentOS7/www/www.laravel.com">

如果拒绝访问,则修改网站根目录权限:

chmod -R 777 /mnt/hgfs/CentOS7/www/www.laravel.com

添加多个虚拟主机

1. 在/etc/httpd/conf.d下新建一个文件vhost.conf,添加以下内容:

<VirtualHost *:80>
ServerName www.volcano.org
DocumentRoot /mnt/hgfs/CentOS7/www/www.volcano.org
ErrorLog /mnt/hgfs/CentOS7/www/log/www.volcano.org/error_log
CustomLog /mnt/hgfs/CentOS7/www/log/www.volcano.org/access_log common
#ServerSignature Off
</VirtualHost>

<Directory "/mnt/hgfs/CentOS7/www/www.volcano.org/">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>

<VirtualHost *:80>
ServerName www.laravel.org
DocumentRoot /mnt/hgfs/CentOS7/www/www.laravel.org
ErrorLog /mnt/hgfs/CentOS7/www/log/www.laravel.org/error_log
CustomLog /mnt/hgfs/CentOS7/www/log/www.laravel.org/access_log common
#ServerSignature Off
</VirtualHost>

<Directory "/mnt/hgfs/CentOS7/www/www.laravel.org/">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>

保证上面用到的几个目录已经建立:

/mnt/hgfs/CentOS7/www/www.volcano.org

/mnt/hgfs/CentOS7/www/log/www.volcano.org/

/mnt/hgfs/CentOS7/www/log/www.volcano.org/

。。。。

2. 重启Apache:
systemctl restart httpd.service
 
3. windows下修改hosts,添加以下两行:

192.168.244.129 www.volcano.org
192.168.244.129 www.laravel.org

ip为Linux主机ip

4. windows下,浏览器输入www.volcano.org和www.laravel.org即可得到对应页面

CentOs7下搭建LAMP环境的更多相关文章

  1. Centos7下搭建LAMP环境,安装wordpress(不会生产博客,只是一名博客搬运工)(菜鸟)

    1.搭建MySQL数据库 安装MariaDB yum install mariadb-server -y 启动MySQL服务 emctl start mariadb #启动服务 emtcl enabl ...

  2. CentOS下搭建LAMP环境详解

    前言:在这里将介绍如何在CentOS下搭建LAMP环境(全部使用源码编译安装),用于web服务器开发. •LAMP: Linux + Apache + PHP + Mysql. •系统: CentOS ...

  3. Centos6.4版本下搭建LAMP环境

    Centos6.4版本下搭建LAMP环境 配置yum mkdir/mnt/cdrom mount/dev/cdrom  /mnt/cdrom 装载光盘 vi /etc/yum.repos.d/Cent ...

  4. linux下搭建lamp环境以及安装swoole扩展

    linux下搭建lamp环境以及安装swoole扩展   一.CentOS 6.5使用yum快速搭建LAMP环境 准备工作:先更新一下yum源  我安装的环境是:apache2.2.15+mysql5 ...

  5. Ubuntu18.04下搭建LAMP环境

    一.Apache2 web 服务器的安装 : 可以先更新一下服务器 1.sudo apt-get update             # 获取最新资源包 2.sudo apt-get upgrade ...

  6. CentOS7下搭建LAMP+FreeRadius+Daloradius Web管理

    注意:本文所有命令均在root命令下执行. freeradius服务官网:http://freeradius.org/ daloradius Web管理页面官网:https://sourceforge ...

  7. Hyperledger超级账本在Centos7下搭建运行环境

    超级账本(hyperledger)是Linux基金会于2015年发起的推进区块链数字技术和交易验证的开源项目,加入成员包括:荷兰银行(ABN AMRO).埃森哲(Accenture)等十几个不同利益体 ...

  8. CentOS6.5下搭建LAMP环境(源码编译方式)

    CentOS 6.5安装配置LAMP服务器(Apache+PHP5+MySQL) 学习PHP脚本编程语言之前,必须先搭建并熟悉开发环境,开发环境有很多种,例如LAMP ,WAMP,MAMP等.这里我介 ...

  9. Centos7下搭建LAMP平台环境 (转载)

     1.启用Apache(httpd) Centos7默认已经安装httpd服务,只是没有启动.如果你需要全新安装,可以yum install -y httpd 启动服务:systemctl start ...

随机推荐

  1. 在Centos6或者7上安装Kafka最新版

    一.官网 http://kafka.apache.org/downloads.html 二.Kafka简介 Kafka是由Apache软件基金会开发的一个开源流处理平台,由Scala和Java编写.K ...

  2. EntityFramework CodeFirst反向工程工具

    EntityFramework Reverse POCO Generator https://marketplace.visualstudio.com/items?itemName=SimonHugh ...

  3. ios实例开发精品源码文章推荐(8.28)

    iOS源码:游戏引擎-推箱子游戏 <ignore_js_op> http://www.apkbus.com/android-106392-1-11.html iOS源码:进度条-Color ...

  4. iPhone X 适配 ( iOS 11适配 )

    总结: 1.状态栏高度发生变化,解决方案:布局的时候这个高度不要写死,通过方法获取高度. 2.导航栏的视图层级结构发生变化而导致 UI(titleView.UIBarButtonItem) 问题. 3 ...

  5. 基于ubuntu搭建 Discuz 论坛

    系统要求:Ubuntu 16.04.1 LTS 64 位操作系统 安装 Apache2 ubuntu 需要安装 Apache2 ,使用 apt-get 安装 Apache2(安装好后,您可以通过访问实 ...

  6. Effective Java 第三版——51. 仔细设计方法签名

    Tips 书中的源代码地址:https://github.com/jbloch/effective-java-3e-source-code 注意,书中的有些代码里方法是基于Java 9 API中的,所 ...

  7. 谈谈MySQL的do语句

    [select在某些场景下的不足] 比如说我们想让MySQL暂停5秒.那么可以这样写 ); +----------+ ) | +----------+ | +----------+ row in se ...

  8. 空间谱专题13:联合解算DOA(ML/AP)

    其中作者:桂. 时间:2017-10-16  07:51:40 链接:http://www.cnblogs.com/xingshansi/p/7675380.html 前言 主要记录二维测向中,分别利 ...

  9. ASCII、Unicode和UTF-8编码的区别

    归纳: 编码 大小 支持语言 ASCII 1个字节 英文 Unicode 2个字节(生僻字4个) 所有语言 UTF-8 1-6个字节,英文字母1个字节,汉字3个字节,生僻字4-6个字节 所有语言 具体 ...

  10. [BigData - Hadoop - YARN] YARN:下一代 Hadoop 计算平台

    Apache Hadoop 是最流行的大数据处理工具之一.它多年来被许多公司成功部署在生产中.尽管 Hadoop 被视为可靠的.可扩展的.富有成本效益的解决方案,但大型开发人员社区仍在不断改进它.最终 ...