全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Centos6.2下快速安装LAMP环境(yum安装) 一、配置防火墙,开启80、3306端口1、防火墙添加80、3306# vim /etc/sysconfig/iptables #打开此表# Firewall configuration written by system-config-firewall# Manual customization of this file is not recommended.*filter:INPUT ACCEPT 0:0:FORWARD ACCEPT 0:0:OUTPUT ACCEPT 0:0-A INPUT -m state -state ESTABLISHED,RELATED -j ACCEPT-A INPUT -p icmp -j ACCEPT-A INPUT -i lo -j ACCEPT-A INPUT -m state -state NEW -m tcp -p tcp -dport 22 -j ACCEPT-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 #添加-A INPUT -j REJECT -reject-with icmp-host-prohibited-A FORWARD -j REJECT -reject-with icmp-host-prohibitedCOMMIT/etc/init.d/iptables restart2 关闭 SELINUX# vi /etc/selinux/config把下面两项注释掉#SELINUX=enforcing #注释掉#SELINUX=targeted #注释掉SELINUX=disabled #增加:wq! # 保存退出# shutdown -r now二、安装apache、mysql、php1 安装apache# yum install httpd #根据提示,选择Y即可安装# /etc/init.d/httpd start # 安装完毕之后,启动apache# chkconfig -level 345 httpd on # 设为开机3、4、5级别自动启动2 安装mysql# yum install mysql mysql-server #同样根据提示,选择Y即可成功安装# chkconfig -level 345 mysqld on # 设为开机3、4、5级别自动启动# cp /usr/share/mysql/f /etc/f # 拷贝配置文件(注:如果/etc目录下面默认有此文件,直接选择覆盖即可)为mysql的root用户设置密码# mysql_secure_installation #回车,根据提示输入Y然后再输入2次相同的密码,回车根据提示,一直输入Y最后看到:Thanks for using MySQL!这样mysql的密码就设置完成,重新启动mysql/etc/init.d/mysqld restart # 重启/etc/init.d/mysqld stop # 停止3 安装php# yum install php #安装php,默认版本为5.3的# yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt #安装相关php组件# /etc/init.d/mysqld restart #重启mysql# /etc/init.d/httpd restart #重启Apache三、 配置apache、mysql、php1 apache 配置# vi /etc/httpd/conf/httpd.conf1) #Servername 80 修改为: Servername 80 (指定为你自己的域名,如果没有域名,设置为localhost)2) ServerTokens OS 修改为: ServerTokens Prod (大约在44行,在出现错误页的时候不显示服务器操作系统名称)3) ServerSignature On 修改为: ServerSignature Off (大约在536行,在错误页中不显示Apache版本)4)Options Indexes FollowSymLinks 修改为:Options Includes ExecCGI FollowSymLinks (大约在在331行,允许服务器执行CGI及SSI,禁止列出目录)5) #AddHandler cgi-script .cgi 修改为:AddHandler cgi-script .cgi .pl (大约在在796行, 允许扩展名为.pl的CGI脚本运行)6)AllowOverride None 修改为:AllowOverride All (大约在338行,允许.htaccess)7)AddDefaultCharset UTF-8 修改为:AddDefaultCharset GB2312 (大约在,在759行 添加GB2312为默认编码)8) Options Indexes MultiViews FollowSymLinks 修改为 Options MultiViews FollowSymLinks (不在浏览器上显示树状目录结构,大约在554行)9) DirectoryIndex index.html index.html.var 修 改为:DirectoryIndex index.html index.htm Default.html Default.htm index.php Default.php index.html.var (设置默认首页文件,增加index.php,约在在402行)10) KeepAlive Off 修改为:KeepAlive On (允许程序性联机 约在76行)11) MaxKeepAliveRequests 100 修改为:MaxKeepAliveRequests 1000 (增加同时连接数,约在83行):wq! #保存退出2 php配置# vi /etc/php.ini 1) date.timezone = PRC #在946行 把前面的分号去掉,改为date.timezone = PRC2) disable_functions =passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname #在386行 列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用3) expose_php = Off #在432行 禁止显示php版本的信息4) magic_quotes_gpc = On #在745行 打开magic_quotes_gpc来防止SQL注入5) short_open_tag = ON #在229行支持php短标签6) open_basedi
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
评论
0/150
提交评论