Linux binary installation apache2.4.25

Source: Internet
Author: User
Tags fully qualified domain name

Linux binary installation apache2.4.25

Installation Environment: CentOS 6.2

First check if Apache is installed.

If the pass is installed through the RPM package, directly with the following command: Rpm-q httpd

You can also use the following two ways:

Httpd-v

Apachectl-v

If you have Apache installed, you will see

One. Prepare the Environment
1. Installing GCC
[email protected]/]# Yum install gcc gcc-c++

2. Installing Apr,apr-util
Download apr-1.4.6.tar.gz and apr-util-1.5.1.tar.gz, address: http://apr.apache.org, upload to/usr/local, install directory/USR/LOCAL/APR and/usr/respectively Local/apr-util

A. Installing the apr-1.4.6.tar.gz
[Email protected] local]# mkdir-p Apr
[Email protected] local]# TAR-ZXF apr-1.4.6.tar.gz
[Email protected] local]# CD apr-1.4.6
[Email protected] apr-1.4.6]#/configure--PREFIX=/USR/LOCAL/APR
[[email protected] apr-1.4.6]# make
[[email protected] apr-1.4.6]# make install

B. Installing apr-util-1.5.1.tar.gz
[Email protected] local]# mkdir-p apr-util
[Email protected] local]# TAR-ZXF apr-util-1.5.1.tar.gz
[Email protected] local]# CD apr-util-1.5.1
[Email protected] apr-util-1.5.1]#/configure--prefix=/usr/local/apr-util-with-apr=/usr/local/apr/bin/ Apr-1-config
[[email protected] apr-util-1.5.1]# make
[[email protected] apr-util-1.5.1]# make install

3. Installing pcre-8.20.tar.gz
: http://sourceforge.net/projects/pcre/files/pcre/, upload to/usr/local, install directory for/usr/local/pcre
[Email protected] local]# mkdir-p pcre
[Email protected] local]# TAR-ZXF pcre-8.20.tar.gz
[Email protected] local]# CD pcre-8.20
[Email protected] pcre-8.20]#/configure--prefix=/usr/local/pcre
[[email protected] pcre-8.20]# make
[[email protected] pcre-8.20]# make install


Two. Installing Apache
1. Download httpd-2.4.25.tar.gz, the address is: http://httpd.apache.org/, upload to/usr/local, install directory for/usr/local/apache2

2. Installation
[Email protected] local]# mkdir-p/usr/local/apache2
[Email protected] local]# tar zxvf httpd-2.4.25.tar.gz
[Email protected] local]# CD httpd-2.4.25
[Email protected] httpd-2.4.25]#/configure--prefix=/usr/local/apache2--with-pcre=/usr/local/pcre--with-apr=/ USR/LOCAL/APR--with-apr-util=/usr/local/apr-util
[[email protected] httpd-2.4.25]# make
[[email protected] httpd-2.4.25]# make install

[[email protected] httpd-2.4.25]#/usr/local/apache2/bin/apachectl start
Visit http://localhost with a browser and see it works!, stating that the CentOS Apache installation was successful, congratulations!

3. Start
The first method [[email protected] apache2]#/usr/local/apache2/bin/apachectl start must be an absolute path

The second method [[email protected] apache2] #service httpd start

The second method [[email protected] apache2]#/etc/init.d/httpd start

Three. Problems with installation
1.configure:error:no acceptable cc found in $PATH
Workaround: Yum install gcc gcc-c++

2.configure:error:apr not found. Please read the documentation.
WORKAROUND: Install Apache's affiliate software
Install apr-1.4.6.tar.gz as above

3.configure:error:apr-util not found. Please read the documentation
Workaround: Install Apr-util
Install apr-util-1.5.1.tar.gz as above

4.CONFIGURE:ERROR:APR version 1.3.0 or later is required
Due to the fact that the APR version is too low, you should uninstall the relevant old version

5. Start the Times wrong:
AH00558:httpd:Could not reliably determine the server ' s fully qualified domain name, using 127.0.0.1. Set the ' ServerName ' directive globally to suppress this message
Rescue method: Absolute path:/usr/local/apache2/bin/apachectl start

To completely not show this line resolution:

Apache/conf/httpd.conf

First find servername (about 213 lines), set it to localhost:80, and delete the previous well, although this step will work if it is not modified, but there is an annoying hint to start the Apache service (AH00558:httpd.exe: Could not reliably determine the server's fully qualified do main name, using fe80::fc76:abca:e24b:d490. Set the ' ServerName ' directive globally to suppress this message)

6. When you are finished installing Apache, when you visit index of/, why isn't it works

It is dangerous to let others know that your site directory structure is directly looking at all the files in your directory.

Here's how to fix this
Apache/conf/httpd.conf
Found it:
Options Indexes FollowSymLinks
Switch
Options FollowSymLinks
When you access a directory directly, the display indicates that the setting was successful.

7. When restarting Apache, reported: DocumentRoot must be a directory

Cause: Apache/confi/httpd.conf has a documentroot configuration file, but there is no directory in the actual directory, note this configuration can be.

8.[[email protected] conf]#/usr/local/apache2/bin/apachectl start

AH00558:httpd:Could not reliably determine the server ' s fully qualified domain name, using Localhost.localdomain. Set the ' ServerName ' directive globally to suppress this message
(98) Address already in use:AH00072:make_sock:could not bind to address [::]:80
(98) Address already in use:AH00072:make_sock:could don't bind to address 0.0.0.0:80
No listening sockets available, shutting down
Ah00015:unable to open logs

Workaround: apache2/conf/httpd.conf Listener 80 Change to a different port number.

Four. Important Configuration Files Directory

/etc/httpd/conf/httpd.conf most important configuration files
/usr/lib/httpd/modules:apache supports a lot of modules, so the modules you want to use are placed in this directory by default
/VAR/LOG/HTTPD Apache default Log
/var/www/html cenos default Home Page directory

Five. Configure Apache, and finally modify the httpd.conf so that Apache can use PHP
Add the following parameters
AddType application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps
AddType Image/x-icon. ico

DirectoryIndex index.php index.html Index.html.var

Linux binary installation apache2.4.25

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.