zoukankan      html  css  js  c++  java
  • 阿里云服务器centos5.10安装lamp环境

    ==相关命令==

    查看linux版本:cat /etc/redhat-release

    ==配置修改==

    一、Apache配置

    -----------------------------------------------------

    vi /etc/httpd/conf/httpd.conf 编辑文件

       Options Indexes FollowSymLinks        在331行 修改为:Options Includes ExecCGI FollowSymLinks(允许服务器执行CGI及SSI)

       #AddHandler cgi-script .cgi        在796行 修改为:AddHandler cgi-script .cgi .pl (允许扩展名为.pl的CGI脚本运行)

       AllowOverride None          在338行 修改为:AllowOverride All (允许.htaccess)

       AddDefaultCharset UTF-8         在759行 修改为:AddDefaultCharset GB2312 (添加GB2312为默认编码)

     Options Indexes MultiViews          找到这一行,将“Indexes”删除 ,变为此状态 Options MultiViews (不在浏览器上显示树状目录结构)

       DirectoryIndex index.html index.html.var          在 402行 修改为:DirectoryIndex index.html index.htm Default.html Default.htm index.php Default.php index.html.var  (设置默认首页文件,增加index.php)

       KeepAlive Off           在76行 修改为:KeepAlive On (允许程序性联机)

       MaxKeepAliveRequests 100          在83行 修改为:MaxKeepAliveRequests 1000 (增加同时连接数)  

    :wq!  #保存退出

       /etc/init.d/httpd restart 重启

       DocumentRoot "/var/www/html"  修改为你的目录   "/data0/www/xxxxxxxxx"  (这个目录就是挂载的数据盘)

       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 combined

     

     

    二、php配置

    -----------------------------------------------------

    vi  /etc/php.ini   #编辑

    date.timezone = PRC     #在946行 把前面的分号去掉,改为date.timezone = PRC

    magic_quotes_gpc = On   #在745行 打开magic_quotes_gpc来防止SQL注入  (php5.4开始不支持magic_quotes_gpc(防SQL流入))

    log_errors = On         #记录错误日志

     

    :wq!  #保存退出

    /etc/init.d/httpd restart   #重启Apche , php

     

    ==相关步骤==

    一.安装配置新的yum源

    wget http://centos.ustc.edu.cn/epel/5/x86_64/epel-release-5-4.noarch.rpm

    wget http://rpms.famillecollet.com/enterprise/5/remi/x86_64/remi-release-5.10-1.el5.remi.noarch.rpm

    rpm -ivh *.rpm

    查看可用的MySQL版本

    # yum --enablerepo=remi list mysql mysql-server php

    使用新yum源安装php5.4,mysql5.5

    yum --enablerepo=remi -y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql

    yum -y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql

    按以前安装的方法,再次修mysql , php 配置文件 

    vi /etc/my.cnf     (主要是修改mysql的数据文件的路径 )

    vi  /etc/php.ini    php5.4不支持magic_quotes_gpc(防SQL流入)

    重启MySQL

    # service mysqld start

    升级MySQL

    # mysql_upgrade -u root -p

    ==相关参考==

    阿里云服务器CentOS 5.7(64位)安装配置LAMP服务器(Apache+PHP5+MySQL)

    Linux rpm 命令参数使用详解[介绍和应用]

    卸载rpm包遭遇error: specifies multiple packages

     

  • 相关阅读:
    Codeforces Round #251 (Div. 2) A
    topcoder SRM 623 DIV2 CatAndRat
    topcoder SRM 623 DIV2 CatchTheBeatEasy
    topcoder SRM 622 DIV2 FibonacciDiv2
    topcoder SRM 622 DIV2 BoxesDiv2
    Leetcode Linked List Cycle II
    leetcode Linked List Cycle
    Leetcode Search Insert Position
    关于vim插件
    Codeforces Round #248 (Div. 2) B. Kuriyama Mirai's Stones
  • 原文地址:https://www.cnblogs.com/ylkk/p/4401938.html
Copyright © 2011-2022 走看看