环境搭建

参考:

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. Win-Sshfs无法连ubuntu1404原因

    ubunbtu 默认不允许root远程访问,设置为允许就可以了 1)vi /etc/ssh/sshd_config,将PermitRootLogin的值改成yes,并保存 PermitRootLogi ...

  2. org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.*.Paper.totalTime

    at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:109) at o ...

  3. MySql之查询基础与进阶

     转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/8283547.html 一:基本查询 SELECT [DISTINCT] 列1,列2,列3... FROM 表 ...

  4. 前后分离模型之封装 Api 调用

    Ajax 和异步处理 调用 API 访问数据采用的 Ajax 方式,这是一个异步过程,异步过程最基本的处理方式是事件或回调,其实这两种处理方式实现原理差不多,都需要在调用异步过程的时候传入一个在异步过 ...

  5. gdb 拾遗

    1,跳过某个特定信号 (gdb) handle SIGPIPE nostop noprint pass 2,break在特定的系统调用处 (gdb) catch syscall 3 3,遇到一个断点的 ...

  6. EF+LINQ事物处理

    在使用EF的情况下,怎么进行事务的处理,来减少数据操作时的失误,比如重复插入数据等等这些问题,这都是经常会遇到的一些问题 但是如果是我有多个站点,然后存在同类型的角色去操作同一条数据的同一个字段的话, ...

  7. 【转】Django中使用POST方法获取POST数据

    1.获取POST中表单键值数据 如果要在django的POST方法中获取表单数据,则在客户端使用JavaScript发送POST数据前,定义post请求头中的请求数据类型: xmlhttp.setRe ...

  8. 【emWin】例程三十二:窗口对象———Progbar

    简介: 进度条通常在应用程序中用于实现虚拟化:本例程实现液晶亮度显示 . 触摸校准(上电可选择是否进入校准界面) 实验现象: 实验指导书及代码包下载: 链接:http://pan.baidu.com/ ...

  9. hbase源码系列(十五)终结篇&Scan续集-->如何查询出来下一个KeyValue

    这是这个系列的最后一篇了,实在没精力写了,本来还想写一下hbck的,这个东西很常用,当hbase的Meta表出现错误的时候,它能够帮助我们进行修复,无奈看到3000多行的代码时,退却了,原谅我这点自私 ...

  10. C语言学习之路

    c语言学习 初识c语言 c语言数据类型.运算符和表达式(整数浮点数) 字符型数据/字符串 算术运算符和算术表达式(优先级,结合性等) 顺序程序设计(运算符之类内容,字符输入输出等) C/C++ 查看数 ...