日期:2011-07-23 23:53:00  来源:本站整理

<b>CentOS 5.6 快速搭建LAMP</b>[服务器安全]

赞助商链接



  本文“<b>CentOS 5.6 快速搭建LAMP</b>[服务器安全]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:

在虚拟机下安装了个CentOS,5.6版本的.操纵NAT情势与宿主pc同享上网!   
当然可以采取编译源码的方法搭建lamp.这里只是介绍快速搭建php开辟框架的办法.其实也没什么,主如果是是利用linux的yum来在线安装.假如上不了网请查找编译源码搭建lamp的文章.网上N多的哈^_^
   1.安装mysql数据库

     号令行下:yum -y install mysql mysql-server   

     Setting up Install Process
     Setting up repositories... ....

     ....................................................

     Installed: mysql-server.i386 0:4.1.20-1.RHEL4.1
     Dependency Installed: mysql.i386 0:4.1.20-1.RHEL4.1 perl-DBD-MySQL.i386 0:2.9004-3.1 perl-DBI.i386 0:1.40-8
     Complete!

    安装完毕,配置mysql:

   号令行下:vi /etc/my.cnf        提醒:红色字为增添的行,主如果设置数据库默许的字符集为utf8

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
default-character-set = utf8
# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

[mysql]

default-character-set = utf8

 保存退出后,设置mysql服务随系统自启动,

号令行下:chkconfig mysqld on

       可以通过chkconfig --list mysqld 查看设置状况,显示 mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off,2~5显示On便可以了.
 

  启动mysql服务, /etc/rc.d.init.d/mysqld start

      Initializing MySQL database:         [ OK ]
      Starting MySQL:              [ OK ]

可以登录mysql举行测试:mysql -u -root                     *(默许root的密码是空的)

呈现提醒符“mysql〉”后,设置root的密码.

以下行动出于安全考虑:

号令行下:mysql> use  mysql;

                    mysql> set password for root@localhost = password('你的密码');

                    mysql> set password for root@localhost.localdomain=password('你的密码');

删除匿名用户: mysql> delete from user where user='';    

删除测试数据库: mysql> drop database test;

至此,mysql数据安装完成,可以用sql操作mysql测试.

2.安装apache

号令行下:yum -y install apache

Setting up Install Process
Setting up repositories

....................................

Complete!

接下来配置apache,编辑Apache的配置文件,号令行下:vi /etc/httpd/conf/httpd.conf

#
# Don't give away too much information about all the subcomponents
# we are running. Comment out this line if you don't mind remote sites
# finding out what major optional modules you are running
ServerTokens OS  ← 找到这一行,将“OS”改成“Prod”(在呈现错误页的时刻不显示服务器操作系统的名称)

ServerTokens Prod   ← 变成此状况

#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of: On | Off | EMail
#
ServerSignature On  ← 找到这一行,将“On”改成“Off”

ServerSignature Off  ← 在错误页中不显示Apache的版本

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work. See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
#ServerName new.host.name:80  ← 改正主机名

ServerNam
  以上是“<b>CentOS 5.6 快速搭建LAMP</b>[服务器安全]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:

  • <b>hosts是什么 hosts文件在什么位置 若何改正hosts</b>
  • <b>在 Windows 8 中手动安装语言包</b>
  • <b>五个常见 PHP数据库问题</b>
  • Windows中Alt键的12个高效快速的利用本领介绍
  • <b>MySQL ORDER BY 的实现解析</b>
  • <b>详解MySQL存储历程参数有三种范例(in、out、inout)</b>
  • <b>Win8系统恢复出来经典的开始菜单的办法</b>
  • <b>Win8系统花屏怎么办 Win8系统花屏的办理办法</b>
  • <b>Windows 7系统下无线网卡安装</b>
  • <b>为什么 Linux不需求碎片整理</b>
  • <b>Windows 8中删除账户的几种办法(图)</b>
  • <b>教你如安在win7下配置路由器</b>
  • 本文地址: 与您的QQ/BBS好友分享!
    • 好的评价 如果您觉得此文章好,就请您
        0%(0)
    • 差的评价 如果您觉得此文章差,就请您
        0%(0)

    文章评论评论内容只代表网友观点,与本站立场无关!

       评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论
    Copyright © 2020-2022 www.xiamiku.com. All Rights Reserved .