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 through source code compilation

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article is about how to install apache 2.4 via source compilation. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

Apache HTTP Server (Apache for short) is an open source web server from the Apache Software Foundation that can run on most computer operating systems and is one of the most popular Web server-side software due to its multi-platform and security.

This document uses source package URL: pan.baidu.com/s/110RWf3VC8J3oJhgYq5jU2w Extract code: pdc0

[root@Jaking12 ~]# yum install -y gcc pcre pcre-devel expat-devel bzip2 openssl-devel zlib* libtool[root@Jaking12 src]# rz[root@Jaking12 src]# tar xvf apr-1.7.0.tar.gz[root@Jaking12 src]# lsapr-1.7.0 apr-1.7.0.tar.gz[root@Jaking12 src]# cd apr-1.7.0[root@Jaking12 apr-1.7.0]# ./ configure --prefix=/usr/local/apr[root@Jaking12 apr-1.7.0]# make[root@Jaking12 apr-1.7.0]# make install[root@Jaking12 apr-1.7.0]# cd .. [root@Jaking12 src]# rzrz waiting to receive.zmodem trl+C ȡ 100% 541 KB 541 KB/s 00:00:01 0 Errors.. [root@Jaking12 src]# lsapr-1.7.0 apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz[root@Jaking12 src]# tar xf apr-util-1.6.1.tar.gz[root@Jaking12 src]# lsapr-1.7.0 apr-1.7.0.tar.gz apr-util-1.6.1 apr-util-1.6.1.tar.gz[root@Jaking12 src]# cd apr-util-1.6.1[root@Jaking12 apr-util-1.6.1]# ./ configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr[root@Jaking12 apr-util-1.6.1]# make[root@Jaking12 apr-util-1.6.1]# make install More options are available via./ configure --help Learn about the official compilation options documentation httpd.apache.org/docs/current/programs/configure.html--prefix=/usr/local/apache--sysconfdir=/etc/httpd //Specify the path where the configuration file is installed. If not specified, the configuration file is in the directory where the program is installed; if specified, the/etc directory--with-apr=/usr/local/apr //Specify the apr path of the dependency. Note that the path must be specified, otherwise the compiler will automatically look for apr under/usr instead of the compiled higher version apr, the same as--with-apr-util=/usr/local/apr-util--with-mpm=MPM //specify default [prefork | worker |event] If all 3 MPM modules are compiled, specify which--with-pcre to use by default //Depends on the pcre library to solve regular expression problems. ##Install pcre-devel (Perl-compatible regular expression library)--enable-so //open so module, enable dynamic load module function--enable-ssl //Enable ssl functionality. Note that you must install it first, https uses--enable-cgi //Enable cgi, use--enable-cgid for mpms that work in non-threaded mode //mpm using--enable-rewrite as worker/event //Support URL rewriting--enable-zlib //Universal compression mechanism--enable-module=most //[ all | most |...] specifies which modules are enabled. You can specify a specific module name, or you can use all to enable all modules, or most to enable most common modules. Most is--enable-mpms-shared=all. //Enable MPM supported mode, which mpm is enabled (prefork, worker, event), compile php differently when using worker or event (compile with-enable-maintainer-zts option)--enable-deflate //Transmission compression mechanism to save bandwidth. It provides compression and transmission encoding for content. It generally supports HTML, JS, CSS and other content sites. Using this parameter will greatly Increase transmission speed to enhance visitor experience. This is an important option for apache tuning in production environments [root@Jaking12 apr-util-1.6.1]# cd.. [root@Jaking12 src]# rzrz waiting to receive.zmodem trl+C ȡ 100% 8983 KB 8983 KB/s 00:00:01 0 Errors[root@Jaking12 src]# lsapr-1.7.0 apr-1.7.0.tar.gz apr-util-1.6.1 apr-util-1.6.1.tar.gz httpd-2.4.39.tar.gz[root@Jaking12 src]# tar xf httpd-2.4.39.tar.gz[root@Jaking12 src]# lsapr-1.7.0 apr-util-1.6.1 httpd-2.4.39apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.39.tar.gz[root@Jaking12 src]# cd httpd-2.4.39[root@Jaking12 httpd-2.4.39]# ./ configure --prefix=/usr/local/apache24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --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[root@Jaking12 httpd-2.4.39]# make[root@Jaking12 httpd-2.4.39]#make install all components /usr/local/apache24 Main configuration file /usr/local/apache24/conf Start script /usr/local/apache24/bin/apachectl[root@Jaking12 httpd-2.4.39]# ls /usr/local/apache24/bin build cgi-bin conf error htdocs icons include logs man manual modules[root@Jaking12 httpd-2.4.39]# ls /usr/local/apache24/conf/extra httpd.conf magic mime.types original[root@Jaking12 httpd-2.4.39]# ls /usr/local/apache24/bin/ab apxs dbmmanage envvars-std htcacheclean htdigest httpd logresolveapachectl checkgid envvars fcgistarter htdbm htpasswd httxt2dbm rotatelogs[root@Jaking12 httpd-2.4.39]# ll /usr/local/apache24/bin/apachectl -rwxr-xr-x 1 root dip 3440 Mar 10 16:45 /usr/local/apache24/bin/apachectl

Start Apache 2.4

[root@Jaking12 httpd-2.4.39]# /usr/local/apache24/bin/apachectlAH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::250:56ff:fe2c:fe97%ens33. Set the 'ServerName' directive globally to suppress this message This is a prompt, the problem is not serious ()…Restart apache2.4[root@Jaking12 httpd-2.4.39]# /usr/local/apache24/bin/apachectl graceful View apache2.4 related information [root@Jaking12 httpd-2.4.39]# netstat -pantul| grep 80tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 807/sshd tcp6 0 0 :::80 :::* LISTEN 35199/httpd tcp6 0 0 :::22 :::* LISTEN 807/sshd [root@Jaking12 httpd-2.4.39]# grep DocumentRoot /usr/local/apache24/conf/httpd.conf # DocumentRoot: The directory out of which you will serve yourDocumentRoot "/usr/local/apache24/htdocs" # access content that does not live under the DocumentRoot. [root@Jaking12 httpd-2.4.39]# ls /usr/local/apache24/htdocsindex.html[root@Jaking12 httpd-2.4.39]# cat /usr/local/apache24/htdocs/index.htmlIt works! [root@Jaking12 httpd-2.4.39]# vim /usr/local/apache24/htdocs/index.htmlIt works! Hello World! Set up file sharing service [root@Jaking12 httpd-2.4.39]# cd /usr/local/apache24/htdocs/[root@Jaking12 htdocs]# lsindex.html[root@Jaking12 htdocs]# touch file{1.. 10}[root@Jaking12 htdocs]# lsfile1 file10 file2 file3 file4 file5 file6 file7 file8 file9 index.html[root@Jaking12 htdocs]# mv index.html index.html.bak[root@Jaking12 htdocs]# lsfile1 file10 file2 file3 file4 file5 file6 file7 file8 file9 index.html.bak Thank you for reading! About "how to install apache2.4 through source compilation" This article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

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