Ubuntu under Apache installation and configuration

Source: Internet
Author: User
Tags fully qualified domain name

There are two ways to install Apache on Ubuntu: 1 Using Package services for development packages, such as using the Apt-get command, and 2 building Apache from the source. This article describes the two different installation methods in detail.

Method One: Use packaged services for the development package--apt-get

To install Apache, enter the command in the command line terminal:

$ sudo apt-get install apache2

After the installation is complete, restart the Apache service and enter the command at the command line terminal:

$ sudo/etc/init.d/apache2 Restart

Problems that may occur 1:namevirtualhost *:80 has no virtualhosts, as follows

The cause of the above problem: Define a number of namevirtualhost, so the/etc/apache2/ports.conf in the Namevirtualhost *:80 comment out.

Problems that may occur 2:could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

Reason:

According to the prompt, can not reliably determine the server's valid domain name, using 127.0.1.1 as the server domain name. In this, in the following test, you should use 127.0.1.1 instead of 127.0.0.1!

Solve:

$ vim/etc/apache2/httpd.conf, add in file:

ServerName localhost:80, restart Apache2 again, you can use 127.0.0.1来 access to the Web server!

Test:

Enter http://localhost or http://127.0.0.1 in the browser, if you see the IT works!, it means that Apache installed successfully, Apache default installation, will be in/var under a directory called WWW, This is the Web directory, all Web files that can be accessed by the browser should be placed in this directory.

You may experience problems during the test:

Cause: The server address used by Apache2 is not 127.0.0.1, according to the previous analysis, the possible IP is 127.0.1.1, access to the http://127.0.1.1.

If you feel you don't need Apache anymore, you can uninstall it:

1. Delete Apache
On the command line, enter:
$ sudo apt-get--purge remove Apache-common
$ sudo apt-get--purge remove Apache


2. Find a profile that is not deleted and delete it.
Code:
$ sudo find/etc-name "*apache*" |xargs RM-RF
$ sudo rm-rf/var/www
$sudo RM-RF/ETC/LIBAPACHE2-MOD-JK

3. Remove the association so that it can be re-installed with the Apt-get install Apache2
#dpkg-L |grep Apache2|awk ' {print $} ' |xargs Dpkg-p

Method Two: Build Apache from the source

Resources:

Install apache+php+mysql:http://www.linuxidc.com/linux/2012-05/61079.htm under Ubuntu

Completely uninstall apache2:http://www.linuxidc.com/linux/2013-06/85825.htm under Ubuntu

Apache Problem Resolution: Httpd:could not reliably determine the server ' s fully qualified domain name link: http://www.linuxidc.com/Linux/ 2012-08/68901.htm

--------------------------------------Split Line--------------------------------------

Apache2 [warn] namevirtualhost *:80 has no virtualhosts solution


Error: [Warn] namevirtualhost *:80 has no virtualhosts

Reason: multiple namevirtualhost are defined

FIX: Ubuntu before version defined in/etc/apache2/sites-available/default, 8.04 after/etc/apache2/ports.conf

The Namevirtualhost *:80 in/etc/apache2/ports.conf can be commented out

The essence of this problem is that the domain name is not defined as a port can only correspond to one virtual host, the Namevirtualhost *:80 to another port can also be resolved

If you have multiple different domain names, you can also use the same port.

For more information about Ubuntu see the Ubuntu feature page http://www.linuxidc.com/topicnews.aspx?tid=2

Ubuntu under Apache installation and configuration

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.