|
First, Linux compile and install apache
1, resolve dependencies
httpd-2.4.4 requires a newer version of the apr and apr-util, and therefore need to be upgraded in advance.
Upgrade There are two ways, one is through the source code compiler installation, a direct upgrade rpm package (carefully! Carefully). Here is the way the line of source code, they download path is: (~ _ ~) here no longer comes there to download, I believe you have the ability to find, Oh
2. Install dependent packages (of course this can be considered as the required build environment slightly!)
yum -y install pcre-devel
yum -y install "Development Libraries" (this thing may already have the system, but be careful, it is best to try to see if installed)
3, then everything is ready to start the installation now! !
(1) compile and install apr
tar xf apr-1.4.6.tar.bz2
cd apr-1.4.6
./configure --prefix = / usr / local / apr
make && make install
(2) compile and install apr-util
tar xf apr-util-1.5.2.tar.bz2
cd apr-util-1.5.2
./configure --prefix = / usr / local / apr-util --with-apr = / usr / local / apr
make && make install
(3) compile and install httpd-2.4.4
tar xf httpd-2.4.4.tar.bz2
cd httpd-2.4.4
./configure --prefix = / usr / local / apache --sysconfdir = / etc / httpd --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 = most --with-mpm = event
make && make install
Second, the test
1, when you start apache attention to the problem:
Before you start Note that SELinux should first be closed, if not closed, then apache may not work properly, the good thing is about iptables (firewall) problems, we recommend testing phase prior to shut down.
2, start the apache service:
# Setenforce 0
# Service iptables stop
# / Usr / local / apache / bin / apachectl start
Open your browser and enter the local ip to see if there are pages flushed out and show
It works!
So apache service can simply work!
To have more features that can modify the httpd.conf configuration file it! ! (Where they would not be introduced)
Third, some of the questions about apache file directory
1. After the RPM installation Apache configuration file specific location:
/ Etc / httpd / -------------------------- Apache root directory services
/etc/httpd/conf/httpd.conf --------- master configuration file
/ Var / www / html --------------------- default page document root directory
/ Var / log / httpd / error_log ---------- error log file
/ Var / log / httpd / access_log -------- access log file
2, the source installation directory files (file directory is uncertain because the compiler so I simply write about the whole thing):
---------------------- Path of the primary configuration file when compiling their own specific configuration files directory --prefix =
------------------- Default installation directory page directory apache htdocs directory
------------------- Install log file location directory apache logs directory
Apache directory service program ---------- installation directory under the bin directory apache
Fourth, common errors
#1#
/ Usr / local / apache / bin / httpd: symbol lookup error: / usr / local / apache / bin / httpd: undefined symbol: apr_pool_pre_cleanup_register
Cause: find the right apr, apr-util path
Resolution: To reinstall apr, apr-util, and write the correct file path.
--with-apr = / usr / local / bin / apr-1-config \
--with-apr-util = / usr / local / apr / bin / apu-1-config
#2#
httpd: apr_sockaddr_info_get () failed for RedHat
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Reason: httpd.conf configuration file ServerName with the host lead to inconsistent
Solution: Modify the configuration file httpd.conf to #ServerName
# 3 #
httpd: Syntax error on line 142 of /usr/local/apache/conf/httpd.conf: Can not load modules / mod_dir.so into server: /usr/local/apache/modules/mod_dir.so: undefined symbol: apr_array_clear
Reason: can not load mod_dir.so module (specifically unknown)
Solution: as follows
tar -zxvf apr-1.4.6.tar.gz
tar -zxvf apr-util-1.5.2.tar.gz
mv ./apr-1.4.6 / usr / local / src / apache / srclib / apr
mv ./apr-util-1.5.2 / usr / local / src / srclib / apr-util
When ./configure, add back
--with-included-apr \
--with-pcre = / usr / local / bin / pcre-config
Because it is not what is written, and in front of the content is not specific modifications, so the inconvenience hope of understanding! ! ! |
|
|
|