1.启用Apache2

Centos7默认已经安装httpd服务,只是没有启动。如果你需要全新安装,可以yum install -y httpd

启动服务:systemctl start httpd.service

设置开机自动启动:systemctl enable httpd.service

HTTP服务器已经启动,进行一下简单配置

vi /etc/httpd/conf/httpd.conf #编辑文件

ServerSignature On  #添加,在错误页中显示Apache的版本,Off为不显示

Options Indexes FollowSymLinks  #修改为:Options Includes ExecCGI FollowSymLinks(允许服务器执行CGI及SSI,禁止列出目录)

#AddHandler cgi-script .cgi #修改为:AddHandler cgi-script .cgi .pl (允许扩展名为.pl的CGI脚本运行)

AllowOverride None #修改为:AllowOverride All (允许.htaccess)

AddDefaultCharset UTF-8 #修改为:AddDefaultCharset GB2312 (添加GB2312为默认编码)

#Options Indexes FollowSymLinks   #修改为 Options FollowSymLinks(不在浏览器上显示树状目录结构)

DirectoryIndex index.html   #修改为:DirectoryIndex index.html index.htm Default.html Default.htm
index.php(设置默认首页文件,增加index.php)

MaxKeepAliveRequests 500
 #添加MaxKeepAliveRequests 500 (增加同时连接数)

:wq! #保存退出

systemctl restart httpd.service #重启apache 

rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html #删除默认测试页

2.设置防火墙

Centos7下的防火墙已经由iptables改为firewall,使用firewall-cmd命令开放80及443端口:

firewall-cmd --permanent --zone=public --add-service=http

firewall-cmd --permanent --zone=public --add-service=https

firewall-cmd --reload

设置SELinux为permissive模式 命令行下 setenforce 0 立即生效,重启失效。

编辑 vim/etc/sysconfig/selinux SELinux=enforcing 修改为disabled 关闭SELinux,重启永久生效。

笔者ip为192.168.1.108,测试下服务器能否打开,浏览器http://192.168.232.128/回车后看到欢迎页面,说明服务器正常运行。

3.安装MariaDB数据库

CentOS 7.0中,已经使用MariaDB替代了MySQL数据库,原因你懂的,MYSQL被Oracle收购以后,前景堪忧,所以MYSQL兄弟MariaDB就出来了,继续开源事业。

安装:yum -y install mariadb-server mariadb

启动:systemctl start mariadb.service

systemctl enable mariadb.service

配置:cp /usr/share/mysql/my-huge.cnf /etc/my.cnf  覆盖原配置就好了。

设置数据库管理员密码:mysql_secure_installation   一路y就可以了,当然第一次y后面要输入两次密码。

4.安装PHP5

安装PHP主程序: yum -y install php

安装PHP组件,使PHP支持 MariaDB

yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel

重启: systemctl restart httpd.service

配置: vi /etc/php.ini

date.timezone = PRC
#把前面的分号去掉,改为date.timezone = PRC

disable_functions =
passthru,exec,system……#列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用。

expose_php = Off #禁止显示php版本的信息

short_open_tag = ON #支持php短标签

open_basedir = .:/tmp/  #设置表示允许访问当前目录(即PHP脚本文件所在之目录)和/tmp/目录,可以防止php木马跨站,如果改了之后安装程序有问题(例如:织梦内容管理系统),可以注销此行,或者直接写上程序的目录/data/www.osyunwei.com/:/tmp/

测试一下:vi /var/www/html/index.php  输入<?php phpinfo(); ?>  wq保存退出。打开http://192.168.232.128/如果能看到PHP配置信息页,说明PHP服务器正常。

Centos7下搭建LAMP平台环境的更多相关文章

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

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

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

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

  3. CentOs7下搭建LAMP环境

    ● 环境搭建 参考: http://blog.csdn.net/zph1234/article/details/51248124 http://www.jb51.net/os/188488.html ...

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

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

  5. Fedora下搭建LAMP开发环境

    LAMP是Linux + Apache + MySQL +PHP/Python的缩写,是一组常用来搭建动态网站服务器的开源软件.它们本身都是各自独立的程序,但是因为开源并且常放在一起使用,所以拥有了越 ...

  6. Centos7 下搭建STF平台

    STF,全名Smartphone Test Farm---智能手机测试平台,可以提供远程真机调试的功能,目前仅支持Android设备. 环境准备 1.Node.js 8 安装Node.js $ cur ...

  7. CentOS7下搭建基本LNMP环境,部署WordPress

    系统环境:CentOS Linux release 7.4.1708 (Core) 3.10.0-693.el7.x86_64 软件版本:nginx-1.12.2.tar.gz php 7.1.11 ...

  8. CentOS6.5下搭建LAMP+FreeRadius+Daloradius Web管理和TP-LINK路由器、H3C交换机连接,实现,上网认证和记账功能

    什么是RADIUS服务: RADIUS:(Remote Authentication Dial In User Service)中文名为远程用户拨号认证服务,简称RADIUS,是目前应用最广泛的AAA ...

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

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

随机推荐

  1. hdu 2031 杨辉三角

    题意:显示杨辉三角形. 解法: 组合数学公式:combi(n,m)=combi(n-1,m-1)+combi(n-1,m); 至于为什么有这个公式呢?那就是高中数学的内容啦 1: #include&l ...

  2. CSS3中的animation动画

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  3. BZOJ2208: [Jsoi2010]连通数

    tarjan缩点后拓扑排序,每一个点用一个bitset记录哪些点能到达它. PS:数据太水,暴力能过. #include<bits/stdc++.h> using namespace st ...

  4. gettextize与glib-gettextize的使用

    gettextize在各种场合都可以使用,用于支持多语言开发 glib-gettextize运行后,会修改po/Makefile.in.in文件,导致后续都必须运行glib-gettextize ge ...

  5. 过滤字符串的Html标记 c#函数 .

    .public static string StripHTML(string strHtml) . { . string[] aryReg ={ . @"<script[^>]* ...

  6. 分页探究--Filter+JSTL

    最近卡了一个功能就是分页,查了很多资料,分页大概是两种类型:一种是把数据库的东西全部查出来然后放在session里,用list一页一页传到页面,这样的消耗比较大;另一种就是使用sql语句的limit来 ...

  7. php函数ob_start()、ob_end_clean()、ob_get_contents()

    下面3个函数的用法 ob_get_contents() - 返回输出缓冲区的内容 ob_flush() - 冲刷出(送出)输出缓冲区中的内容 ob_clean() - 清空(擦掉)输出缓冲区 ob_e ...

  8. C#----使用WindowsMediaPlayer 同时播放多个声音

    使用Windows Media Player 其实就是使用组件AxWindowsMediaPlayer. 添加两个引用:Interop.WMPLib.dll和AxInterop.WMPLib.dll. ...

  9. VBO, VAO, Generic Vertex Attribute

    VBO - 用于存储顶点数据的Buffer Object. VAO - 用于组织VBO的对象. Generic Vertex Attribute - 通用顶点属性. For example, the ...

  10. GLSL扩展预处理器(支持#include)

    http://www.gamedev.net/topic/645610-do-you-extend-glsl/ https://github.com/ehsan/ogre/blob/master/Re ...