Linux environment source code to build Apache service

1. Check whether
[root@d ~]# rpm -qa | grep httpd
system-config-httpd-1.3.3.1-1.el5
httpd-manual-2.2.3-6.el5

2. Stop and uninstall the Linux system The built-in httpd service
[root@d ~]# service httpd stop
[root@d ~]# ps -ef | grep httpd
[root@d ~]# kill -9 pid number (delete one by one)
[root@d ~] # rpm -e system-config-httpd-1.3.3.1-1.el5
[root@d ~]# rpm -e httpd-manual-2.2.3-6.el5
Find out if the apache configuration file exists, delete it if it exists
[root@d ~]# find / -name httpd.conf

3. Download the Apache installation package (httpd-2.4.3.tar.gz or httpd-2.2.23.tar.gz), download address: http://httpd .apache.org/
When installing Apache, I installed them for different versions, which were different at compile time, and the parameters followed by configure were different.
Compile command for httpd-2.2.23 version:
[root@d ~]# ./configure --prefix=/usr/local/apache2 (You can install it directly without adding any parameters after the installation directory parameter)
[root@d ~]# make
[root@d ~]# make install
httpd-2.4.3 version compilation command:
[root@d ~]# ./configure --prefix=/usr/local/apache2 --with- apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
(In addition to specifying the Apache installation directory, also install apr, apr-util, pcre, and specify the parameters)
[root@d ~]# make
[root@d ~]# make install
appears apr not respectively when compiling Apache (the problem encountered when installing httpd-2.4.3) found, APR-util not found, pcre-config for libpcre not found,
let's solve these problems of httpd-2.4.3 to actually operate.
http://apr.apache.org/download.cgi Download apr-1.4.5.tar.gz, apr-util-1.3.12.tar.gz
http://sourceforge.net/projects/pcre/files/latest /download Download pcre-8.31.zip
A. Solve the problem of apr not found
  [root@localhost bin]# tar -zxf apr-1.4.5.tar.gz
  [root@localhost apr-1.4.5]# ./configure --prefix=/usr/local/apr
  [root@localhost apr-1.4.5]# make
  [root@localhost apr-1.4.5]# make install
B.解决APR-util not found问题
  [root@localhost bin]# tar -zxf apr-util-1.3.12.tar.gz
  [root@localhost apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config
  [root@localhost apr-util-1.3.12]# make
  [root@localhost apr-util-1.3.12]# make install
C、解决pcre-config for libpcre not found问题
  [root@localhost ~]# unzip pcre-8.31.zip
  [root@localhost ~]# cd pcre-8.31
  [root@localhost pcre-8.31]# ./configure --prefix=/usr/local/pcre
  [root@localhost pcre-8.31]# make
  [root@localhost pcre-8.31]# make install

If /etc/httpd/httpd.conf already exists, please uninstall or close the web service that comes with the Linux system first, execute the command: chkconfig httpd off,
or put the one that comes with Linux The port 80 of the httpd service is changed to another port, as long as it does not conflict with the port of the Apache service we installed.
Start Apache: /usr/local/apache2/bin/apachectl start
Stop Apache: /usr/local/apache2/bin/apachectl stop
Restart Apache: /usr/local/apache2/bin/apachectl restart

The website is placed in /usr/local/ In the apache2/htdocs directory, go through http://localhost:80
in the browser. If you see the words "It works!" displayed on the page, it means that Apache has passed the verification. If the index suffix of the website is in jsp format,
you need to modify the httpd.conf configuration file (/usr/local/apache2/conf) and add index.jsp to DirectoryIndex.
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

Follow the official account and reply to cms to get the development video of cms system



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326110922&siteId=291194637