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

What are the steps of building an Apache server in Linux system

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Linux system to build Apache server steps, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

Introduction to apache server: Apache is the most widely used web server in the world. It is famous for its cross-platform, high efficiency and stability.

The disadvantage of Apache is that it becomes heavier and heavier and is generally regarded as a heavyweight web server. Apache mainly uses process-based Prefork mode (and thread-based Worker mode), that is, each request will be served by one process, and the process takes up a lot of resources. When the amount of concurrency is large, it needs the same amount of processes, resulting in high memory and CPU usage, which is the so-called "heavyweight".

Apache is based on modular design, on the whole, the readability of the code is higher than that of php code, its core code is not much, most of the functions are divided into various modules, and each module is loaded on demand when the system starts.

Linux system to build apache server detailed steps: compressed package installation method

1. Download httpd-2.4.29.tar.gz

2. Upload to server / usr/local/software

Tar-zxvf httpd- 2.4.29.tar.gz``. / configure-- prefix=/usr/local/apache2/ # set the apache installation directory. If Apr is not installed, an error will be reported:

Checking ``for`` APR... No``configure: error: APR not found. Please read the documentation.3, then install apr, download apr-1.6.3.tar.gz first

4. Upload to server / usr/local/software

Tar-zxvf apr- 1.6.3.tar.gz``cd apr- 1.6.3``.normalre``make``make install will report an error again:

Checking ``for`` APR-util... No``configure: error: APR-util not found. Please read the documentation.5, download apr-util-1.6.1.tar.gz

6. Upload to server / usr/local/software

Tar-zxvf apr-util- 1.6.1.tar.gz`cd apr-util- 1.6.1``./ configure-- prefix=/usr/local/apr-util/-- with-apr=/usr/local/apr will also report an error at this time:

Xml/apr_xml.c:35:19: fatal error: expat.h: there is no interruption in the compilation of the file or directory `accounde`^ ``. ``make: * * [xml/apr_xml.lo] error 17. Guess is a development library that may be missing expat

Yum install expat-devel # will let you type y``./ configure-- prefix=/usr/local/apr-util/-- with-apr=/usr/local/ apr`make # success! ``make install8, go back to install apache at this time, specify not only the path of apr, but also the path of apr-util

. / configure-- prefix=/usr/local/apache2/-- with-apr=/usr/local/apr/-- with-apr-util=/usr/local/apr-util/ still reported an error. Many people may have collapsed when they came here, but this error is similar to the one encountered before.

Checking ``for`` pcre-config... False`configure: error: pcre-config ``for`` libpcre not found. PCRE is required ``and``available from http: ``/ / pcre.org/9, download pcre-8.41.tar.gz

10. Upload to server / usr/local/software

Tar-zxvf pcre- 8.41.tar.gz``. / configure reported an error again, I'm sure this is the last time

Checking windows.h usability... No``bicycle windows.h presence... No```for`` windows.h... No``configure: error: You need a C++ compiler ``for`` C++ support.10, install C++ environment

Yum install-y gcc gcc-c++ ``# wrong so many times, don't forget where you are now, next you still have to install pcre``. / make`make install11, well, after a big circle, next you still have to install apache

Cd.. ``cd apache``. / configure-- prefix=/usr/local/apache2/-- with-apr=/usr/local/apr/-- with-apr-util=/usr/local/apr-util/ ``make`make install how miserable! The last step is to report an error:

/ usr/local/apr- util`` / / lib/libaprutil-1.so: undefined reference to `lib/libaprutil-1.so ``/ usr/local/apr- util`` / / lib/libaprutil-1.so: undefined reference to `XML_SetEntityDeclHandler'`` / usr/local/apr-u til`` / / lib/libaprutil-1.so: undefined reference to `XML_ ParserCre``status`make2: error: ld returned 1 ``exit``status`make [2]: error 1``make [2]: Leaving directory `/ usr/local/software/apache/support' `make [ 1]: * * [all-recursive] error 1``make [1]: Leaving directory `/ usr/local/software/apache/support' this kind of error has not been seen before After a decisive online search, the answer is: the apr version is too high.

So I downloaded apr-util-1.5 http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz

13. Upload to server / usr/local/software

Tar-zxvf apr-util- 1.5.2.tar.gz``cd apr-util- 1.5.2``./ configure-- prefix=/usr/local/apr-util-1.5/-- with-apr=/usr/local/ apr`make`make install14, repeat step 11, the only difference is that the configuration now specifies: apr-util-1.5, which is very important!

Cd.. ``cd apache``./ configure-- prefix=/usr/local/apache2/-- with-apr=/usr/local/apr/-- with-apr-util=/usr/local/apr-util-1.5/ ``make # make time will be longer ``make install perfect ending:

Installing configuration files``mkdir`` / usr/local/apache2/ conf``mkdir`` / usr/local/apache2/conf/ files``mkdir`` / usr/local/apache2/conf/ personal``mkdir`` / usr/local/apache2/conf/original/ `Instal ling HTML documents``mkdir`` / usr/local/apache2/ htdocs`Installing error documents``mkdir`` / usr/local/apache2/ error`Installing s`mkdir`` / usr/local/apache2/ Icons`mkdir` / usr/local/apache2/log s`Installing CGIs``mkdir`` / usr/local/apache2/cgi- bin`Installing header files`mkdir`` / usr/local/apache2/ `files`de`Installing build system files`mkdir` / usr/local/ Apache2/ build``Installing man pages ``and``online manual``mkdir`` / usr/local/apache2/ man``mkdir`` / usr/local/apache2/man/ man1``mkdir`` / usr/local/apache2/man/ man8``mkdir`` / usr/local/apache2/ manual``mkdir` [1]: Leaving directory `/ usr/local/software/apache'15, Enter the configuration file location: / usr/local/apache2/conf

Cp httpd.conf httpd.conf.bak # backup configuration file ``vim httpd.conf`` # uncomment the 191line and modify it to: ``ServerName [your IP]: 80``: wq16, launch apache

/ usr/local/apache2/bin/apachectl start`` # or ``/ usr/local/ apache2`` / / bin/httpd-k start turn off the firewall, enter the server's ip in the browser address bar and the web page will appear: It works!

17. Close apache

Ps-ef | grep apache`` / usr/local/apache2/bin/apachectl stop`` # or ``/ usr/local/ apache2`` / / bin/httpd-k stop`` # Yes, the original file installation method of`` / / in front of bin is too complicated. In fact, there is another way to install apache service. I don't know if it conflicts with my previous installation. Let's try it today.

Yum source installation mode

1. Yum source installation (network download is required)

First shut down the apache service ``yum install httpd # enter: yResult:

Installed as a dependency:

``apr.x86_64 0apr-util.x86_64 1.4.8-3.el7_4.1 ````apr-util.x86_64 0pur1.5.2-6.el7 ````httpd-tools.x86_64 0apr-util.x86_64 2.4.6-67.el7.centos.6 `mailcap.noarch 0apr-util.x86_64 2.1.41-2.el7 ``is over! 2. The installation location of yum is at: / etc/httpd/conf. After I enter the backup configuration file, the modification is different from that before. It is on line 95, for reference only.

Cd / etc/httpd/ conf``cp httpd.conf httpd.conf.bak`` # drop the comment on line 95 and change it to: ``ServerName [your IP]: 80``: wq3, start the service

Systemctl start httpd.service type ip in the browser, and the html preset by apache appears. Perfect!

4. Shut down the service

Systemctl stop httpd.service5, I went to start the httpd installed in the first way again

/ usr/local/apache2/bin/apachectl start refresh browser suddenly appears: It worksinstalled, indicating that there is no conflict between the two installation methods.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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

Development

Wechat

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

12
Report