CentOS 6.5 配置LAMP环境

一、配置防火墙

vim   /etc/sysconfig/iptables

开启80端口、3306端口

-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT

  重启 

service   iptables     restart

二、更新yum源:

yum      clean   all

yum      check-update                                    

yum      update

 中途会提示你是否同意下载,输入y,回车

 时间有点长

三、PHP

安装

yum    -y  install  php

四、MySql

安装:

yum    install     mysql-server

chkconfig     –add     mysqld

service    mysqld     restart 

mysql    -uroot   -p

你想要设置的密码

mysql_secure_installation 

提示:

Remove anonymous users?     [Y/n]                         建议:y            是否删掉匿名用户   

Disallow root login remotely?    [Y/n]                       建议:y            是否取消远程root登录

Remove test database and access to it?    [Y/n]        建议:y            是否删掉测试数据库

Reload privilege tables now?    [Y/n]                        建议:y            是否现在重新加载


配置:


1.主配文件:

vim     /etc/my.cnf

修改如下:

《CentOS 6.5 配置LAMP环境》
红色为修改内容

2.设置 MySql 开机启动

chkconfig    mysqld     on

查看状态:chkconfig  –list  |  grep    mysqld                       (2-5为on)

3.启动MySql:

service   mysqld     start

五、apache


安装

yum     -y      install     apache

配置

vim       /etc/httpd/conf/httpd.conf

               用“/”命令搜索更改:

ServerTokens  OS    →    ServerTokens Prod

ServerSignature  On    →   ServerSignature Off

DirectoryIndex  index.html  index.html.var    →  DirectoryIndex   index.html  index.php

Options Indexes FollowSymLinks    →   Options Includes ExecCGI FollowSymLinks

#AddHandler cgi-script .cgi  →  AddHandler cgi-script .cgi .pl

AllowOverride None  →  AllowOverride All

Options Indexes MultiViews   →    Options MultiViews

设置开机启动

chkconfig   httpd   on

重启

service    httpd  start

    原文作者:Insrce
    原文地址: https://www.jianshu.com/p/e28a08339ee2
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞