环境搭建

参考:

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. iOS 录制视频MOV格式转MP4

    使用UIImagePickerController系统控制器录制视频时,默认生成的格式是MOV,如果要转成MP4格式的,我们需要使用AVAssetExportSession; 支持转换的视频质量:低, ...

  2. Oracle 12c RMAN备份文档

    创建备份目录,查看剩余空间 [cistest@cistest ~]$ df -h df: '/home/oratest/.gvfs': Permission denied Filesystem Siz ...

  3. Oracle 12c利用数据泵DataPump进行Oracle数据库备份

    1.查看数据库版本 SQL> select version from v$instance; VERSION ----------------- 12.1.0.2.0 2.sysdba用户登录s ...

  4. 卸载系统自动jdk

    执行下面的代码可以看到当前各种JDK版本和配置: sudo update-alternatives --config java   卸载系统自动jdk [root@localhost soft]# r ...

  5. mysqlcheck与myisamchk的区别

    mysqlcheck和myisamchk都可以用来检测和修复表.(主要是MyISAM表)但是也有以下不同点:1.都可以检查.分析和修复myisam表.但是mysqlcheck也可以检查.分析innod ...

  6. MySQL设置全局sql日志

     分别执行开启日志以及日志路径和日志文件名 SET GLOBAL general_log_file = '/var/lib/mysql/localhost.log';SET GLOBAL genera ...

  7. 一道简单的HashMap面试题所想到的...

    前言 看到一个JDK1.7和JDK1.8中关于HashMap的一个面试题: JDK1.7和1.8中HashMap中链表的插入的方式有什么不同? 原以为自己对HashMap的源码理解的还算可以了,应该足 ...

  8. 三星S4 i9508 4.4.2 root 教程

    现在有很多一键root的软件,但是各怀鬼胎,最好不用. 最近玩腻了三方的rom,刷回了官方的rom,顿时更稳定了,以外的是这个版本的导航被切了,拍手叫好啊.输入法引入了搜狗的云输入,更方便了,官方的输 ...

  9. 【spark 深入学习 06】RDD编程之旅基础篇02-Spaek shell

    --------------------- 本节内容: · Spark转换 RDD操作实例 · Spark行动 RDD操作实例 · 参考资料 --------------------- 关于学习编程方 ...

  10. Gtk-WARNING**:无法在模块路径中找到主题引擎:“pixmap”的解决

    Gtk-WARNING**:无法在模块路径中找到主题引擎:“pixmap”的解决  解决以上问题, 只需要安装 gnome-themes-standard 即可 如果终端中提示:   (gvim:23 ...