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

Install the Apache web server

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

█ install Apache2.4.23

New modules for ●:

Mod_proxy_fcgi (fcgi agent is available)

Mod_ratelimit (restrict subscriber broadband)

Mod_request (request module that filters requests)

Mod_remoteip (matches the IP address of the client)

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

New features added to ●:

MPM supports loading at run time, but to enable this feature, enable-- enable-mpms-shared=all-- with-mpm=event when compiling and installing

Support for event

Support for asynchronous read and write

Specify the log level on each module and each directory

Enhanced expression parser

Per request configuration:

Millisecond keepalive timeout

FQDN-based virtual machines no longer need NameVirtualHost instructions

Support for the use of custom variables

● installation environment: centos7.2, close selinux

1. Compile and install Apache2.4.23

Download the source package:

Http-2.4.23.tar.gz

Apr-1.5.2.tar.gz (Portable Runtime Library, which is used to realize the use of the operating system by Apache internal components and improve the portability of the system)

Apr-util-1.5.4.tar.gz

Zlib-1.2.8.tar.gz

Pcre-8.39.tar.gz

① 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

Tar zxf apr-util-1.5.4.tar.gz

Cd apr-util-1.5.4.tar.gz

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

Make & & make install

③ install zlib

Tar zxf zlib-1.2.8.tar.gz

Cd zlib-1.2.8/

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

Make & & make install

④ install pcre

Tar zxf pcre-8.39.tar.gz

Cd pcre-8.39/

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

Make & & make install

⑤ installs openssl (centos7 comes with a version of openssl-1.0.1e, which is too low)

Download openssl:wget https://www.openssl.org/source/openssl-1.0.1u.tar.gz

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.1u

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

⑥ install Apache2.4.34

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-- 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

★ Note: explanation of relevant parameters

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

-- enable-cgi: enable cgi

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

-- enable-ssl: supports ssl

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

-- enable-rewrite: url rewriting is supported

-- 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-modules=most: explicitly specify the module to be statically compiled into the httpd binary file, including all modules for the space-separated list of module names, all or most,all for all modules, and most for most commonly used modules

-- enable-mods-shared=most: explicitly specify the module to be compiled in DSO, including all modules for the space-separated list of module names, all or most,all, and most for most commonly used modules.

-- enable-mpms-shared=all: enable all supported modes of MPM so that event, worker, and prefork are installed in a modular manner. To use that, just configure it in httpd.conf.

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

-- enable-expires: activate or control the "Expires:" and "Cache-Control:" headers of HTTP through configuration files, that is, provide settings for client browser cache for website images, js, css, etc.

-- enable-deflate: sites that provide compression, transmission and coding support for content, such as html, js, css, etc. The use of this parameter will greatly improve the transmission speed and improve the experience of visitors.

Make & & make install

● optimizes the execution path of http programs

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

● modifies the configuration file httpd.conf to set the ServerName value in it

For example: ServerName www.test.com

● starts the Apache server

/ usr/local/http-2.4.23/bin/apachectl start

● starts automatically when it is powered on

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

Edit the / etc/init.d/httpd file by ● and add the following below the first line:

# chkconfig: 35 85 15

# description: apache-2.4.23

● adds Apache to boot and starts automatically.

Chkconfig-add httpd

Chkconfig httpd on

● starts the compiled Apache 2.4.23

Service httpd start

Netstat-anplt | grep 80

2. Yum install Apache

Update native service: yum update

Install Apache:yum-y install apache

Start Apache:service httpd start

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

Servers

Wechat

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

12
Report