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

修改如下:

红色为修改内容

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


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

友情链接更多精彩内容