The Apache Web Service
Installing Apache Steps
The first step is unpacking:
[Email protected] ~]# TAR-XF httpd-2.4.32.tar.gz-c/usr/local/
The second step is to switch in:
[Email protected] ~]# cd/usr/local/httpd-2.4.32/
The third step is to configure, compile, and compile the installation:
[Email protected] httpd-2.4.32]#/configure--prefix=/usr/local/httpd--sysconfdir=/etc/httpd--enable-so-- Enable-ssl--enable-cgi--enable-rewrite--enable-zlib--enable-modules=most--enable-mpms-shared=most--with-mpm= Event
Direct compilation will error:
Checking for APR ... no
Configure:error:APR not found. Please read the documentation.
Installing Apr with Yum is no use, it may be a version issue, the following is a compiled and installed solution:
Apr Package
Http://mirror.bit.edu.cn/apache/apr/apr-1.6.3.tar.gz
Unzip the package:
Installing apr-1.6.3
[Email protected] ~]# tar XF apr-1.6.3.tar.gz-c/usr/local/src/
Configuration compilation:
[Email protected] ~]# cd/usr/local/src/
[Email protected] src]# CD apr-1.6.3/
[Email protected] apr-1.6.3]#/configure--PREFIX=/USR/LOCAL/APR
[[email protected] apr-1.6.3]# make && make install
Installing apr-util-1.6.1
[Email protected] ~]# TAR-XF apr-util-1.6.1.tar.gz-c/usr/local/src/
[Email protected] ~]# cd/usr/local/src/
[Email protected] src]# CD APR-UTIL-1.6.1/
[Email protected] apr-util-1.6.1]#/configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr
[[email protected] apr-util-1.6.1]# make && make install
Compile times wrong:
XML/APR_XML.C:35:19: Error: expat.h: no file or directory
XML/APR_XML.C:66: Error: expected specifier-qualifier-list before ' Xml_parser '
XML/APR_XML.C: In the function ' Cleanup_parser ':
xml/apr_xml.c:364: Error: ' Apr_xml_parser ' does not have a member named ' XP '
xml/apr_xml.c:365: Error: ' Apr_xml_parser ' does not have a member named ' XP '
XML/APR_XML.C: At the file level:
xml/apr_xml.c:384: Error: expected '; ', ', ' or ') ' before ' * ' token
XML/APR_XML.C: In the function ' apr_xml_parser_create ':
xml/apr_xml.c:401: Error: ' Apr_xml_parser ' does not have a member named ' XP '
xml/apr_xml.c:402: Error: ' Apr_xml_parser ' does not have a member named ' XP '
xml/apr_xml.c:410: Error: ' Apr_xml_parser ' does not have a member named ' XP '
xml/apr_xml.c:411: Error: ' Apr_xml_parser ' does not have a member named ' XP '
xml/apr_xml.c:412: Error: ' Apr_xml_parser ' does not have a member named ' XP '
xml/apr_xml.c:424: Error: ' Apr_xml_parser ' does not have a member named ' XP '
xml/apr_xml.c:424: Error: ' Default_handler ' not declared (first use within this function)
xml/apr_xml.c:424: Error: (even if multiple occurrences occur within a function, each undeclared identifier is in its
xml/apr_xml.c:424: Error: The function inside is also reported only once. )
XML/APR_XML.C: In the function ' Do_parse ':
xml/apr_xml.c:434: Error: ' Apr_xml_parser ' does not have a member named ' XP '
xml/apr_xml.c:438: Error: ' Apr_xml_parser ' does not have a member named ' XP '
xml/apr_xml.c:442: Error: ' Apr_xml_parser ' does not have a member named ' Xp_err '
xml/apr_xml.c:442: Error: ' Apr_xml_parser ' does not have a member named ' XP '
XML/APR_XML.C: In the function ' Apr_xml_parser_geterror ':
XML/APR_XML.C:500: Error: ' Apr_xml_parser ' does not have a member named ' Xp_err '
XML/APR_XML.C:500: Error: ' Apr_xml_parser ' does not have a member named ' Xp_err '
MAKE[1]:
[Xml/apr_xml.lo] Error 1
MAKE[1]: Leaving directory '/usr/local/src/apr-util-1.6.1 '
Make: [All-recursive] Error 1
The above error resolution solution:
[email protected] apr-util-1.6.1]# Yum install-y expat-devel
Recompile after installation:
[[email protected] apr-util-1.6.1]# make && make install
The above packages are installed and then cut into the httpd directory to configure the compiled installation:
[Email protected] apr-util-1.6.1]# cd/usr/local/httpd-2.4.32/
[Email protected] httpd-2.4.32]#/configure--prefix=/usr/local/httpd--sysconfdir=/etc/httpd--enable-so-- Enable-ssl--enable-cgi--enable-rewrite--enable-zlib--enable-modules=most--enable-mpms-shared=most--with-mpm= Event--WITH-APR=/USR/LOCAL/APR--with-apr-util=/usr/local/apr-util/(requires additional installation paths for the specified Apr and apr-util).
The following error occurred:
Checking which MPM to use by default ... event
Configure:error:MPM Most does isn't support dynamic loading.
Workaround:
Change--enable-mpms-shared=most in configuration to all
The following configuration parameters are modified:
[Email protected] httpd-2.4.32]#/configure--prefix=/usr/local/httpd--sysconfdir=/etc/httpd--enable-so-- Enable-ssl--enable-cgi--enable-rewrite--enable-zlib--enable-modules=most--enable-mpms-shared=all--with-mpm= Event--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/
Following the above configuration is basically no error, followed by compiling and compiling the installation:
[[email protected] httpd-2.4.32]# make && make install
Compile if the following error is reported:
MAKE[2]:
[htpasswd] Error 1
MAKE[2]: Leaving directory '/usr/local/httpd-2.4.32/support '
MAKE[1]: [All-recursive] Error 1
MAKE[1]: Leaving directory '/usr/local/httpd-2.4.32/support '
Make: * * [all-recursive] Error 1
Workaround:
[Email protected] httpd-2.4.32]# ln-s/USR/LIB64/LIBM.A/USR/LIB/LIBM.A
[Email protected] httpd-2.4.32]# ln-s/usr/lib64/libm.so/usr/lib/libm.so
[Email protected] httpd-2.4.32]# ln-s/usr/lib64/libexpat.so/usr/lib/libexpat.so
[[email protected] httpd-2.4.32]# make && make install
compile if still report the following error: that is the APR and apr-util version of the problem, CENTOS6 should install version 1.5, 1.6 version or version too low will have a problem
MAKE[2]: *[HTPASSWD] Error 1
MAKE[2]: Leaving directory /usr/local/httpd-2.4.32/support‘<br/>make[1]: * [all-recursive] 错误 1<br/>make[1]: Leaving directory
/usr/local/httpd-2.4.32/support '
Make: *[All-recursive] Error 1
Reinstall the 1.5 version of Add a configuration item in the reconfiguration
[Email protected] httpd-2.4.32]#/configure--prefix=/usr/local/httpd--sysconfdir=/etc/httpd--enable-so-- Enable-ssl--enable-cgi--enable-rewrite--enable-zlib--enable-modules=most--enable-mpms-shared=all--with-mpm= Event--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util--with-included-apr
If the following error occurs:
Configure:error:Bundled APR requested but not found at./srclib/. Download and unpack the corresponding APR and Apr-util packages to./srclib/.
Solution:
[Email protected] src]# CP-FR APR-1.5.1/USR/LOCAL/HTTPD-2.4.33/SRCLIB/APR
[Email protected] src]# cp-fr APR-UTIL-1.5.1//usr/local/httpd-2.4.33/srclib/apr-util
Put the unpacked package into/usr/local/httpd-2.4.32/srclib/(remove the version number)
Error: Configure:error:pcre-config for Libpcre not found. PCRE is required and available from http://pcre.org/
Solution: Yum install-y pcre-devel
Fix the problem and reconfigure
[Email protected] httpd-2.4.32]#/configure--prefix=/usr/local/httpd--sysconfdir=/etc/httpd--enable-so-- Enable-ssl--enable-cgi--enable-rewrite--enable-zlib--enable-modules=most--enable-mpms-shared=all--with-mpm= Event--WITH-APR=/USR/LOCAL/APR--with-apr-util=/usr/local/apr-util--with-included-apr--enable-deflate-- Enable-expires
Compile and compile the installation after the configuration is complete:
[[email protected] httpd-2.4.32]# make && make install
Copy script after completion:
[Email protected] local]# CP/USR/LOCAL/HTTPD/BIN/APACHECTL/ETC/INIT.D/HTTPD
[[email protected] local]#/etc/init.d/httpd start
[Email protected] local]# Netstat-anpt|grep httpd
TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 55654/httpd
To configure a virtual host:
[Email protected] local]# vim/etc/httpd/httpd.conf
Virtual hosts
include/etc/httpd/extra/httpd-vhosts.conf (Remove the comment from this line)
[Email protected] local]# vim/etc/httpd/extra/httpd-vhosts.conf
<directory "/var/www" >
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
Require all granted
</Directory>
<virtualhost 192.168.0.50:80>
ServerAdmin [email protected]
DocumentRoot "/var/www"
ServerName www.benet.com
Serveralias benet.com
Errorlog "Logs/www.benet.com-error_log"
Customlog "Logs/www.benet.com-access_log" common
</VirtualHost>
Apache-2.4.32 Installation