zoukankan      html  css  js  c++  java
  • centos 6.5 64位编译 apache2.4

    apache 2.4的安装和 apache2.2的安装有所不同

    首先进入 http://apr.apache.org/download.cgi

    下载 apr 和 apr-util 两个软件包

    yum -y install gcc-c++ libtool-libs  安装所需的依赖包

    安装 apr

          tar -zxvf apr-1.5.2.tar.gz

          cd apr-1.5.2

          ./configure --prefix=/usr/local/apr  

          make  

          make install  

          make clean

          apr安装完毕

    安装 apr-util

          tar -zxvf apr-util-1.5.4.tar.gz 

          cd apr-util-1.5.4

          ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config

         make

         make install

         make clean

         apr-util 安装完毕

    安装 pcre

           tar -zxvf pcre-8.31.tar.gz

           cd pcre-8.31 

          ./configure --prefix=/usr/local/pcre

          make

          make install

          make clean

          pcre 安装完毕

    安装 openssl

        tar -zxvf openssl-1.0.1c.tar.gz

        cd openssl-1.0.1c

        ./config no-shared no-idea no-mdc2 no-rc5 zlib enable-tlsext no-ssl2 --prefix=/usr/local/openssl

        make depend

       make install

       安装openssl 完毕

     

    安装 apache2.4

         tar -zxvf httpd-2.4.12

         cd httpd-2.4.12

        

    ./configure --prefix=/usr/local/apache --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-so --enable-rewrite --enable-ssl --enable-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --with-ssl=/usr/local/openssl/ --enable-modules=most

         make 

        make install

        cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
        vi /etc/init.d/httpd 在第二行加入以下两行内容

                # chkconfig: 2345 10 90

                # description: Activates/Deactivates Apache Web Server

          /sbin/chkconfig --add httpd
          /sbin/chkconfig --level 2345 httpd on

         groupadd www

         useradd -g www -s /sbin/nologin www

         chown -R www:www /usr/local/apache

      5. 关闭selinux

               A 不需要重启Linux:
                setenforce 0
               B 需要重启Linux:
               vi /etc/selinux/config 将SELINUX=enforcing 改成SELINUX=disable 

            6. 修改apache的配置文件 httpd.conf

                1.  将  AllowOverride None  改成  AllowOverride all

               2.  修改错误日志的配置

               ErrorLog "| /usr/local/apache/bin/rotatelogs /var/log/apache_log/%Y_%m_%d_error_log 86400 480"

               3.  修改访问日志的配置

               CustomLog "| /usr/local/apache/bin/rotatelogs /var/log/apache_log/%Y_%m_%d_access_log 86400 480" combined

               4.禁止列目录

               Options FollowSymLinks

               5 修改运行的用户和用户组

                User www
                Group www

               6. 在 最后一行添加

                ServerName 127.0.0.1  (实际服务器的ip)

     域名配置

    <VirtualHost *:80>
    DocumentRoot /www/web/project
    ServerName www.domain.com
    ServerAlias domain.com
    directoryindex index.html index.php
    defaulttype text/html
    addtype application/x-httpd-php .html
    adddefaultcharset utf-8

    <Directory /www/web/project/>
    Options -Indexes +FollowSymLinks
    AllowOverride All
    Require all granted
    </Directory>
    </VirtualHost>

            关闭防火墙 

               chkconfig iptables off

               service iptables stop

            重启服务器

               shutdown -r now

             访问

             http://www.domain.com

             如果访问正常 就OK  如果访问不正常 可以根据实际情况进行调整

        

  • 相关阅读:
    ubuntu 14.04 LTS 163更新源
    Windows 2008R2 修改SID
    ubuntu14 使用rsync远程备份文件
    vim常用
    Ubuntu创建lvm
    Windows 迁移本地用户配置文件到域用户
    Linux scp使用
    Centos 7 修改网卡名称、静态IP
    Axel多线程工具安装
    testlink 1.9.19安装
  • 原文地址:https://www.cnblogs.com/jackspider/p/4644105.html
Copyright © 2011-2022 走看看