In the previous blog, I recorded how to install and start mysql in Linux. Address: http://blog.csdn.net/wy3552128/article/details/8143686
Platform: Virtual centos4.7 on VMware
HOST: windows
Preparations before installing Apache:
1. Check whether the httpd service configuration file exists in the environment. The default storage path is/etc/httpd. conf (this is an ent version of Apache pre-installed in centos. We usually install the source code version of Apache ). If/etc/httpd. conf already exists, uninstall or disable the web service that comes with centos and run the following command:Chkconfig
Httpd offOr change the port 80 of the httpd service that comes with centos to another port, as long as it does not conflict with the port of the installed Apache service.
Stop and uninstall the httpd service in Linux:
1. service httpd stop
2. ps-ef | grep httpd
3. kill-9 pid (delete one by one)
4. rpm-qa | grep
Httpd
5. rpm
-E httpd Software Package
[root@localhost bin]# find / -name httpd.conf[root@localhost bin]#
2、download apacheinstallation package (httpd-2.4.3.tar.gzor httpd-2.2.23.tar.gz),: http://httpd.apache.org/
When installing Apache, I installed different versions of Apache, which were different during compilation, and different parameters followed by configure.
Httpd-2.2.23 version compile command:
./Configure -- prefix =/usr/local/apache2 (installation directory parameters can be directly installed without any parameters) makemake install
Httpd-2.4.3 version compile command:
. /Configure -- prefix =/usr/local/apache2 -- with-apr =/usr/local/apr -- with-apr-util =/usr/local/apr-util/-- -pcre =/usr/local/pcre (except for the specified Apache installation directory, also install apr, apr-util, and pcre, and specify the parameter) makemake install
When compiling Apache (problems encountered during httpd-2.4.3 installation), the problems of apr not found, APR-util not found, pcre-config for libpcre not found were found, below to solve these problems of httpd-2.4.3 to actual operation.
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
1. Solve the apr not found Problem
[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
2. Solve the APR-util not found Problem
[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
3. Solve the Problem of 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 already exists. conf: uninstall or disable the web service that comes with the centos system, run the command: chkconfig httpd off, or change port 80 of the httpd service that comes with centos to another port, as long as it does not conflict with the port of the installed Apache service.
• 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 stored in the/usr/local/apache2/htdocs directory.
In IE, http: // localhost: 80 is used. If "It works!" is displayed on the page !" Indicates that Apache authentication is successful. If the index Suffix of the website is in PHP format, modify the httpd. conf configuration file (/usr/local/apache2/conf) and add index. php In DirectoryIndex.
## DirectoryIndex: sets the file that Apache will serve if a directory# is requested.#<IfModule dir_module> DirectoryIndex index.html index.php</IfModule>