Install Apache HTTP Server 2.4 under Linux

Compile and install

Execute before installation:

# yum install -y gcc gcc-c++

# yum install -y expat expat-devel openssl-devel

 

Download apache httpd 2.4 , the installation package does not contain APR  , APR-Util and  Perl-Compatible Regular Expressions Library (PCRE) , if it has not been installed in the system, it needs to be downloaded and installed.

Note: apr and apr-util should use version 1.5.x, pcre should use pcre-8.x.

 

After downloading the installation package, unzip it, enter the root directory, and execute the following commands:

 

install apr

    # ./configure --prefix=/usr/local/apr
    # make
    # make install

 

install apr-util

    # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
    # make
    # make install

 

install pcre

    # ./configure --prefix=/usr/local/pcre
    # make
    # make install

 

install httpd

    # ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --enable-so  --enable-mods-shared=most --enable-ssl

    # make

    # make install

 

start httpd
     $ /usr/local/apache2.4/bin/apachectl start

 

     If an error is reported after startup: Failed to lookup provider 'shm' for 'slotmem': is mod_slotmem_shm loaded?

     Modify the httpd.conf configuration file and release the module.

 

Install with YUM on RHEL 7

The httpd provided in the default repository of RHEL is generally not the latest version. To install a new version, you can use the CodeIT repositoriy (providing the latest versions of Apache and Nginx).

Install EPEL first

# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 

Install CodeIT repository

cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el7.repo

install httpd

# yum install httpd

 

Attached:

httpd.conf production environment security configuration

ServerTokens Prod

Header always set Strict-Transport-Security "max-age=8640000; includeSubDomains; preload"

 

使用YUM安装PHP 7.2

# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

# yum --enablerepo=remi-php72 install php

 

How to Install The Latest Apache Server (httpd) on Centos 7

How to Install PHP 7.2, Apache 2.4, MySQL 5.6 on CentOS/RHEL 7.4 & 6.9

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326146394&siteId=291194637