Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Apache2.4.23

2025-03-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to install Apache2.4.23, the article is very detailed, has a certain reference value, interested friends must read it!

1. New features of Apache2.4

1. New module

Mod_proxy_fcgi (fcgi agent is available)

Mod_ratelimit (limit user bandwidth)

Mod_request (request module that filters requests)

Mod_remoteip (matches the IP address of the client)

The access control based on IP has been modified, and the allow,deny,order mechanism is no longer supported, but require is used uniformly.

2.MPM supports loading at run time; however, to enable this feature, you need to enable these three features in the compilation installation.

-enable-mpms-shared=all-with-mpm=event

3. Support for event, which is the latest working mode of Apache.

4. Support for asynchronous read and write

5. Specify the log level on each module and each directory

6. Enhanced expression parser

7. Per request configuration:

8. Millisecond keepalive timeout

9. FQDN-based virtual hosts no longer need NameVirtualHost instructions

10. Support for the use of custom variables

II. Compile and install Apache2.4.23

System environment: Centos7.3, turn off selinux

Required source package:

Httpd-2.4.23.tar.gz

Apr-1.5.2.tar.gz

Apr-util-1.5.4.tar.gz

Zlib-1.2.8.tar.gz

Pcre-8.39.tar.gz

Here, download these packages in advance and store them in the / root/ directory.

Note: apr (Apache Portable Runtime) Apache portable runtime is an abstract library for calling the operating system, which is used to realize the use of the operating system by the internal components of Apache and improve the portability of the system.

Here is the installation of Apache2.4.23 through a script:

# install apr

Tar zxf apr-1.5.2.tar.gz

Cd apr-1.5.2/

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

Make

Make install

# install apr-util

Cd / root/

Tar zxf apr-util-1.5.4.tar.gz

Cd apr-util-1.5.4/

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

Make

Make install

# install zlib

Cd / root/

Tar zxf zlib-1.2.8.tar.gz

Cd zlib-1.2.8/

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

Make

Make install

# install pcre

Cd / root/

Tar zxf pcre-8.39.tar.gz

Cd pcre-8.39/

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

Make

Make install

# install openssl

Cd / root/

Tar zxf openssl-1.0.1u.tar.gz

Cd openssl-1.0.1u/

. / config-fPIC-- prefix=/usr/local/openssl enable-shared

Make

Make install

Mv / usr/bin/openssl / usr/bin/openssl.1.0.1e

Ln-s / usr/local/openssl/bin/openssl / usr/bin/openssl

# install httpd

Cd / root/

Tar zxf httpd-2.4.23.tar.gz

Cd httpd-2.4.23/

. / configure-- prefix=/usr/local/http-2.4.23-- enable-so-- enable-cgi-- enable-cgid-- enable-ssl-- with-ssl=/usr/local/openssl-- enable-rewrite-- with-pcre=/usr/local/pcre-- with-z=/usr/local/zlib-- with-apr=/usr/local/apr-- with-apr-util=/usr/local/apr-util-- enable-modules=most-- enable-mods-shared=most-- enable-mpms- Shared=all-with-mpm=event-enable-proxy--enable-proxy-fcgi-enable-expires-enable-deflate

Make

Make install

Ln-s / usr/local/http-2.4.23/bin/* / usr/local/bin/

# Automatic startup after switch on

Cp / usr/local/http-2.4.23/bin/apachectl / etc/init.d/httpd

Sed-I'1i # chkconfig: 35 85 15\ n # description: apache 2.4.23'/ etc/init.d/httpd

Chkconfig-add httpd

Chkconfig httpd on

# startup httpd

Sed-I'1i ServerName www.test.com' / usr/local/http-2.4.23/conf/httpd.conf

/ etc/init.d/httpd-t

/ etc/init.d/httpd start

Netstat-utpln | grep httpd

Firewall-cmd-permanent-add-service=http

Firewall-cmd-reload

Note: centos7 comes with version openssl-1.0.1e is too low for apache2.4.23. You need to download and install openssl-1.0.1u.

Explanation of parameters related to httpd configuration:

-- enable-so: support dynamic sharing module (that is, turn on DSO support)

-- enable-rewrite: url rewriting is supported

-- enable-ssl: supports ssl

-- with-ssl=/usr/local/openssl: specify the location where ssl is installed

-- enable-cgi: enable cgi

-- enable-cgid:MPM uses event or worker to enable cgid

-- enable-modules=most: clearly indicates the module to be statically compiled into the httpd binary file. It is a space-separated list of module names, all or most,all that contains all modules, and most that contains most commonly used modules.

-- enable-mods-shared=most: clearly indicates the module to be compiled in DSO. It is a space-separated list of module names, all or most,all that contains all module blocks, and most that contains most modules.

-- enable-mpms-shared=all: enable all the modes supported by MPM, so that event, worker, and prefork are installed in a modular manner, and which one you want to use can be configured in httpd.conf.

-- with-mpm=event: specifies the enabled mpm mode, which defaults to enevt mode. In earlier versions of apache, the default prefork,2.2 version is worker,2.4 version is event.

-- with-pcre=/usr/local/pcre: supports pcre

-- with-z=/usr/local/zlib: using the zlib compression library

-- with-apr=/usr/local/apr: specify the installation path for apr

-- with-apr-util=/usr/local/apr-util: specify the installation path for apr-util

-- enable-expires: activate HTTP to control the "Expires:" and "Cache-Control:" headers through configuration files, that is, to provide client browser cache settings for website images, js, css, and other content. This is one of the important options for apache tuning.

-- enable-deflate: sites that provide compression, transmission and coding support for content, such as html, js, css, etc. Using this parameter will increase the transmission speed and improve the visitor's access experience. This is one of the important options for apache tuning in a production environment.

Second, the problems and solutions after the completion of the installation

You can see that port 80 is listening, indicating that the httpd service is normal. However, it was wrong to check its status, saying that the command "lynx" could not be found. Next, we will explain the ideas and methods to solve this problem.

"lynx" is a text-only web browser, and the "lynx" command may not be found because the package is not installed.

After installing "lynx", check the status of httpd and indicate that "/ server-status" cannot be found in the requested URL, so we can take a look at the information about "/ server-status" in the httpd startup script:

From the comments, you can see that the URL link is the status page of the mod_status module. The previous error message indicates that the status page cannot be found. It may be that there is no configuration information for the resource in the main configuration file.

Through the above steps, we can determine that the status page information of "/ server-status" is defined in the configuration file httpd-info.conf, so we need to load httpd-info.conf in the main configuration file and remove the "#" before the configuration line "Include conf / extra/httpd-info.conf".

Start the httpd service gracefully, check its status again, and find that you do not have permission to view the status page, then modify the httpd-info.conf to give you permission to view the status page:

Start httpd gracefully and check its status successfully!

The above is all the contents of the article "how to install Apache2.4.23". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report