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 ...
随机推荐
- 视觉SLAM中的数学基础 第二篇 四元数
视觉SLAM中的数学基础 第二篇 四元数 什么是四元数 相比欧拉角,四元数(Quaternion)则是一种紧凑.易于迭代.又不会出现奇异值的表示方法.它在程序中广为使用,例如ROS和几个著名的SLAM ...
- [Python]编码声明:是coding:utf-8还是coding=urf-8呢
推荐: #!/usr/bin/env python3 # -*- coding: utf-8 -*- 我们知道在Python源码的头文件中要声明编码方式,如果你不只是会用到ascii码,很多人都写得都 ...
- React Native库版本升级与降级
迄今为止React Native获得了超过48K的star,最新版本0.44,已经趋于稳定.(官网地址:https://github.com/facebook/react-native).随着Reac ...
- 微信公众号 几种移动端UI框架介绍
微信公众号开发,主要是移动端网页的页面开发,在这里推荐3个移动端UI框架:WeUI.SUI和Mint UI. 1. WeUI 1.1 WeUI WeUI是微信官方设计团队为微信 Web 开发量身设计, ...
- 如何用javac 和java 编译运行整个Java工程
转自:http://blog.csdn.net/huagong_adu/article/details/6929817 前言:本文教你怎么用javac和Java命令,以及如何利用脚本(she ...
- 物联网架构成长之路(18)-接阿里云OSS服务
1.申请/购买OSS服务 在阿里云上申请/购买OSS服务, 然后在会得AccessKeyID,AccessKeySecret,bucketName 这三个东西 2.增删改查 在pom.xml文件上增加 ...
- (转-经典-数据段)C++回顾之static用法总结、对象的存储,作用域与生存期
转自:https://blog.csdn.net/ab198604/article/details/19158697相关知识补充:https://www.cnblogs.com/rednodel/p/ ...
- Zookeeper之Zookeeper底层客户端架构实现原理(转载)
Zookeeper的Client直接与用户打交道,是我们使用Zookeeper的interface.了解ZK Client的结构和工作原理有利于我们合理的使用ZK,并能在使用中更早的发现问题.本文将在 ...
- mxnet:背景介绍
学习的过程 使用mxnet作为教程的深度学习库,重点介绍高层抽象包gluon 双轨学习法,既教授大家从零实现,也教授大家使用gluon实现模型:前者为了理解深度学习的底层设计,后者将大家从繁琐的模型设 ...
- windows后门
原文:揭秘Windows系统的四个后门 组策略欺骗后门 创建一个批处理文件add.bat,内容是: @echo off net user hack$ test168 /add net localgro ...