您的位置:首页 > 运维架构 > Apache

centos 6.5 安装配置LAMP(linux,apache,mysql,php)环境

2014-07-19 23:18 1166 查看
安装webtatic资源包:
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
安装remi资源包
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm[/code] 
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm[/code] 
(需要不同的版本可自行选择不同的资源包)一、安装apahce1、更新yumyum update输入y更新2、安装apacheyum install httpd输入y安装3、可选择安装apache的帮助文档yum install httpd-manual访问文档:http://localhost/manual/howto/cgi4、启动apache/etc/init.d/httpd start  (restart:重启)   或者   service httpd start  (restart:重启)启动之后会报错误:Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 10.171.202.8 for ServerName可以忽略这个错误,也可解决,方法如下:打开apache配置文件:vim /etc/httpd/conf/httpd.conf找到 #ServerName www.example.com:80  改我自己的域名或者localhost 重启apache即可解决5、开机启动apachechkconfig httpd on二、安装mysql1、选择版本:可自行去搜索第三方yum资源包yum  install mysql mysql-server mysql-devel2、启动mysql/etc/init.d/mysqld start  (restart:重启)   或者   service mysqld start  (restart:重启)3、开机启动mysqlchkconfig mysqld on4、更改my.cnf文件cp /usr/share/mysql/my-medium.cnf /etc/my.cnf 如果存在直接覆盖5、设置密码安装好mysql后会自动设置一个密码主要安装信息也可使用mysql_secure_installation:第一步按回车,之后输入两次密码,一直按Y即可三、安装php1、选择版本:可自行去搜索第三方yum资源包yum  install php php-pdo php-mcrypt php-gd php-xml php-mbstring 2、重启apache mysqlapache简单配置说明打开文件 vim /etc/httpd/conf/httpd.conf这3项没用到,看到很多人写我也就加上了KeepAlive Off           在76行修改为:KeepAlive On (允许程序性联机)Options Indexes FollowSymLinks    在331行 修改为:Options Includes ExecCGI FollowSymLinks(允许服务器执行CGI及SSI)#AddHandler cgi-script .cgi             在796行 修改为:AddHandler cgi-script .cgi .pl (允许扩展名为.pl的CGI脚本运行)这5项有用到AllowOverride None   在338行 修改为:AllowOverride All (允许.htaccess)AddDefaultCharset UTF-8 在759行 设置字符编码,按需配置Options Indexes        配置域名时如果将 Indexes 删除:不在浏览器上显示树状目录结构DirectoryIndex index.html index.html.var   在 402行 设置默认首页文件,增加index.php等MaxKeepAliveRequests 100  在83行 修改为 1000 (增加同时连接数)修改apache解析目录DocumentRoot "/var/www/html"  修改为你的目录   "/data0/www/xxx"  (这个目录就是挂载的数据盘)rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html    #删除默认测试页 Apache的日志文件   ErrorLog  /etc/httpd/logs/error_log   (php的错误日志也输出到这里)CustomLog  /etc/httpd/logs/access_log combinedphp简单配置打开配置文件 vim  /etc/php.ini date.timezone = PRC    把前面的分号去掉,改为date.timezone = PRC 中国时区magic_quotes_gpc = On   #在745行 打开magic_quotes_gpc来防止SQL注入  (php5.4开始不支持)) 重启apache关于apache php mysql的配置更多要自己去查阅相关资料
                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  lamp mysql php apache linux