收藏 分销(赏)

Centos6.2下快速安装LAMP环境(yum安装).doc

上传人:pc****0 文档编号:7769822 上传时间:2025-01-16 格式:DOC 页数:5 大小:99.50KB 下载积分:10 金币
下载 相关 举报
Centos6.2下快速安装LAMP环境(yum安装).doc_第1页
第1页 / 共5页
Centos6.2下快速安装LAMP环境(yum安装).doc_第2页
第2页 / 共5页


点击查看更多>>
资源描述
一、配置防火墙,开启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-prohibited COMMIT /etc/init.d/iptables restart  2 关闭 SELINUX  # vi /etc/selinux/config 把下面两项注释掉 #SELINUX=enforcing #注释掉 #SELINUX=targeted #注释掉 SELINUX=disabled   #增加 :wq!  # 保存退出 # shutdown -r now  二、安装apache、mysql、php 1 安装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/my-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、php 1 apache 配置 # vi /etc/httpd/conf/httpd.conf 1) #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 = PRC 2) 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_basedir = .:/tmp/ #在380行 设置表示允许访问当前目录(即PHP脚本文件所在之目录)和/tmp/目录,可以防止php木马跨站,如果改了之后安装程序有问题,可以注销此行,或者直接写上程序的目录/data/web/:/tmp/ :wq!    #保存退出     /etc/init.d/mysqld restart    # 重启Mysql /etc/init.d/httpd  restart    # 重启Apache
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 百科休闲 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4009-655-100  投诉/维权电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服