Apache Server Installation and troubleshooting solutions
After several days of installation, the entire process of installing the source code of the Apache server is roughly clear. Record it here. You are welcome to discuss it together. Thank you!
The following three points are described:
- The whole process of installing the Apache server
- Cannot use an external APR with the bundled APR-util error reported during installation
- Port occupied error reported during installation
Use the latest version 2.2.27 to download httpd from the official website. The following is an installation demonstration.
1. Enter the directory where the downloaded httpd-2.2.27.tar.gz file is located and perform the decompression:
Input command: tar-zxvf httpd-2.2.27.tar.gz
After decompression, a folder will be created.
2. Go to the root directory of the decompressed Folder:
Enter the command: cd httpd-2.2.27
The files in the folder are roughly as follows:
3. Configure compilation parameters:
Enter the command:./configure -- prefix =/usr/local/apache2 -- enable-mod-shared = all
The Cannot use an external APR with the bundled APR-util error may be reported during compilation parameter configuration. I also encountered it before, but there was no record at the time, therefore, we reference others' articles at the end of the article as a prompt.
4. Compile and install:
Enter the command: make & make install
After the installation is complete, there is an apache2 file in the/usr/local/folder, which is caused by Step 2 configuration.
Files in the folder
5. After the installation is complete, you need to configure the conf/httpd. conf file and modify the Servername in the file. The configuration is localhost: 80, which can be changed as needed.
(I have not configured it before, and the error message is related to the error message that is not configured here. Please note that)
The configuration of the httpd. conf file contains some parameters. You can refer to an article here for configuration.
Address: http://tonyguo.blog.51cto.com/379574/168534
6. Start the Apache service
Enter the following command:
/Usr/local/apache2/bin/apachectl start
I have an error message indicating that the port is occupied,
------------------------------------------------------ Error message success -------------------------------------------------------------------------------------------
Starting httpd: cocould not reliably determine the server's fully qualified domain name, using localhost. localdomain for ServerName (98) Address already in use: make_sock: cocould not bind to address [:]: 80 (98) Address already in use: make_sock: cocould not bind to address 0.0.0.0: 80
No listening sockets available, shutting down
Unable to open logs
Certificate ----------------------------------------------------------------------------------------------------------------------------------------------------------
Some people may also encounter this problem. I will record it here as follows:
Here we will conduct fault diagnosis, check port 80 usage and handle it.
Enter the following command:
Netstat-lnp | grep 80
Ps xxx (corresponding port number)
Kill-9 xxx (corresponding port number)
It was found that the previous configuration was left behind and was modified.
Enter the following command:
Vi/etc/rc. d/rc. local
Query again after modification. The results are as follows:
Here is the modification of the/etc/rc. d/rc. local file, remove the previous legacy
View port usage after modification
Run netstat-lnp | grep 80.
This port is enabled. Why?
Use other processing commands for processing:
Enter the following command:
Ps-aux | grep http
Ps-aux | grep apache
Kill-9 xxx (xxx indicates the port number corresponding to the above search results)
Next let's take a look at the port usage
Run netstat-lnp | grep 80.
Start Service:/usr/local/apache2/bin/apachectl start
Open the browser and enter localhost: 80 to check whether the startup is successful. The result is as follows:
Sometimes this problem occurs during installation. I have encountered it before, but I have not recorded it. Here, I will reference a record in someone else's article:
Certificate ---------------------------------------------------------------------------------------------------------------------------------------
3.2 solution to Cannot use an external APR with the bundled APR-util error during apache installation
See: http://blog.csdn.net/bluishglc/article/details/6867358
Sometimes, this error is reported when you install apache and perform the./configure operation. The solution is to install the apr carried by apache2.2.x. The method is as follows:
1. Self-source installation directory httpd-2.2.21 into the installation directory of apache2.2.x with apr
Cd srclib/apr
2. Install apr. (install it in/usr/local/apr. If apr has been installed in the system, find the installation directory to overwrite it)
./Configure -- prefix =/usr/local/apr
Makemake install
3. Install apr-util
./Configure -- prefix =/usr/local/apr-util -- with-apr =/usr/local/apr
Make
Make install
4. Use the newly installed apr to re-compile and configure apache.
Put back the installation root directory httpd-2.2.21 and execute:
. /Configure -- prefix =/usr/local/apache2 -- enable-mod-shared = all -- with-apr =/usr/local/apr -- with-apr-util =/usr/ local/apr-util/bin
Supplement:
If you are installing apache-2.4 or later, the following differences exist:
1. You need to download apr and apr-util separately.
Apr: http://mirror.bjtu.edu.cn/apache//apr/apr-1.4.6.tar.bz2
Apr-util: http://mirror.bjtu.edu.cn/apache//apr/apr-util-1.4.1.tar.bz2
2. You also need to install pcre
Go to http://pcre.org/download pcre, decompress it into the source code directory for execution
./Configure -- prefix =/usr/local/pcre
3. configure when installing apache.
. /Configure -- prefix =/usr/local/apache2 -- enable-mod-shared = all -- with-apr =/usr/local/apr -- with-apr-util =/usr/ local/apr-util/bin -- with-pcre =/usr/local/pcre
Install a Web Server on Ubuntu Server 14.04 (Linux + Apache + MySQL + PHP)
Install and configure the PHP environment in Linux (Apache2)
How to enable Apache Rewrite in Ubuntu
Key points after upgrading Apache 14.04 to 2.2 in Ubuntu 2.4
Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04
Compile and install LAMP in CentOS 5.9 (Apache 2.2.44 + MySQL 5.6.10 + PHP 5.4.12)
Source code for Web server architecture in RedHat 5.4 build the LAMP environment and application PHPWind
Build a WEB Server Linux + Apache + MySQL + PHP in the LAMP source code Environment
Apache details: click here
Apache: click here
This article permanently updates the link address: