CentOs7下搭建LAMP环境
● 环境搭建
参考:
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/
。。。。
192.168.244.129 www.volcano.org
192.168.244.129 www.laravel.org
ip为Linux主机ip
CentOs7下搭建LAMP环境的更多相关文章
- Centos7下搭建LAMP环境,安装wordpress(不会生产博客,只是一名博客搬运工)(菜鸟)
1.搭建MySQL数据库 安装MariaDB yum install mariadb-server -y 启动MySQL服务 emctl start mariadb #启动服务 emtcl enabl ...
- CentOS下搭建LAMP环境详解
前言:在这里将介绍如何在CentOS下搭建LAMP环境(全部使用源码编译安装),用于web服务器开发. •LAMP: Linux + Apache + PHP + Mysql. •系统: CentOS ...
- Centos6.4版本下搭建LAMP环境
Centos6.4版本下搭建LAMP环境 配置yum mkdir/mnt/cdrom mount/dev/cdrom /mnt/cdrom 装载光盘 vi /etc/yum.repos.d/Cent ...
- linux下搭建lamp环境以及安装swoole扩展
linux下搭建lamp环境以及安装swoole扩展 一.CentOS 6.5使用yum快速搭建LAMP环境 准备工作:先更新一下yum源 我安装的环境是:apache2.2.15+mysql5 ...
- Ubuntu18.04下搭建LAMP环境
一.Apache2 web 服务器的安装 : 可以先更新一下服务器 1.sudo apt-get update # 获取最新资源包 2.sudo apt-get upgrade ...
- CentOS7下搭建LAMP+FreeRadius+Daloradius Web管理
注意:本文所有命令均在root命令下执行. freeradius服务官网:http://freeradius.org/ daloradius Web管理页面官网:https://sourceforge ...
- Hyperledger超级账本在Centos7下搭建运行环境
超级账本(hyperledger)是Linux基金会于2015年发起的推进区块链数字技术和交易验证的开源项目,加入成员包括:荷兰银行(ABN AMRO).埃森哲(Accenture)等十几个不同利益体 ...
- CentOS6.5下搭建LAMP环境(源码编译方式)
CentOS 6.5安装配置LAMP服务器(Apache+PHP5+MySQL) 学习PHP脚本编程语言之前,必须先搭建并熟悉开发环境,开发环境有很多种,例如LAMP ,WAMP,MAMP等.这里我介 ...
- Centos7下搭建LAMP平台环境 (转载)
1.启用Apache(httpd) Centos7默认已经安装httpd服务,只是没有启动.如果你需要全新安装,可以yum install -y httpd 启动服务:systemctl start ...
随机推荐
- 基于Centos7.5搭建Docker环境
docker很火,基于容器化技术,实现一次编译到运行.实现运行环境+服务的一键式打包! 00.部署环境 centos7.5(基于vmware搭建的测试环境,可以跟互联网交互,桥接方式联网) docke ...
- 【Windows】Dos中的日期的和时间
在Dos中,我们可以通过动态变量DATE来取得当前日期,通过动态变量TIME来取得当前日期.实例1 C:\Users\hubin5>echo %date% 2013/03/11 周一 C:\Us ...
- EasyUI 的 combotree 加载数据后折叠起来,并且只允许单击子节点的写法
$(source).combotree({ url: '', width: kuan, valueField: 'id', textField: 'text', onlyLeafCheck: true ...
- 【LeetCode-面试算法经典-Java实现】【062-Unique Paths(唯一路径)】
[062-Unique Paths(唯一路径)] [LeetCode-面试算法经典-Java实现][全部题目文件夹索引] 原题 A robot is located at the top-left c ...
- React Native库版本升级与降级
迄今为止React Native获得了超过48K的star,最新版本0.44,已经趋于稳定.(官网地址:https://github.com/facebook/react-native).随着Reac ...
- android开发的童鞋们 你该学点C++
更多关于C++的知识点,请关注android开发应该学点C++(索引贴)android开发应该学点C++(其他) (*android开发论坛----android开发学习----android开发*) ...
- 建立一个基本的UI
本章让你熟悉Xcode来写应用程序.你会熟悉Xcode项目的结构,并学习如何在基本项目组件中导航.通过整个课程中,您将开始为FoodTracker应用程序制作一个简单的用户界面(UI),并在模拟器查看 ...
- [svc]find+xargs/sed&sed后向引用+awk多匹配符+过滤行绝招总结&&产生随机数
30天内的文件打包 find ./test_log -type f -mtime -30|xargs tar -cvf test_log.tar.gz find,文件+超过7天+超过1M的+按日期为文 ...
- 开发FTP不要使用sun.net.ftp.ftpClient
转自:http://cai21cn.iteye.com/blog/700188 在开发一个web应用过程中,需要开发一个服务使用ftp功能将数据传输一个网外的ftp服务器.最初使用sun.net.ft ...
- 【Python】socket模块应用
[Socket] 本文记录了一些socket模块的简单应用,对于具体原理还没来得及深究. ■ 利用socket模块进行端口连接验证和扫描 在linux中常用nc命令来进行远端端口是否开放的验证.但是这 ...