随笔 - 137  文章 - 1  评论 - 3  阅读 - 14万 

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  如果访问不正常 可以根据实际情况进行调整

    

posted on   ヽ坚强的蘑菇  阅读(493)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示