Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of installing apache in ubuntu

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to install apache in ubuntu. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

There are two ways to install Apache on Ubuntu: 1 to use the packaged services of the development package, such as the apt-get command, and 2 to build Apache from source code.

Method 1: use the package service of the development package-- apt-get

Install apache and enter the following command in the command line terminal:

$sudo apt-get install apache2

After the installation is complete, restart the apache service and enter the following command in the command line terminal:

$sudo / etc/init.d/apache2 restart

Possible problem 1: NameVirtualHost *: 80 has no VirtualHosts

The reason for the above problem: multiple NameVirtualHost are defined, so you can comment out the NameVirtualHost *: 80 in / etc/apache2/ports.conf.

Possible problem 2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

Reason: according to the prompt, it is impossible to reliably determine the valid domain name of the server, using 127.0.1.1 as the server domain name. Therefore, in the following tests, you should use 127.0.1.1 instead of 127.0.0.1!

Resolve:

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

ServerName localhost:80, restart apache2 again and you can use 127.0.0.1 to access the web server!

Test:

Type http://localhost or http://127.0.0.1 in the browser, and if you see It workskeeper, it means that Apache has been successfully installed. The default installation of Apache will create a directory called www under / var. This is the Web directory, and all Web files that can be accessed by the browser should be placed in this directory.

Problems may be encountered during testing: 404 not found

Reason: 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. Just visit http://127.0.1.1.

If you feel that you no longer need apache, 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

two。 Find the configuration files that have not been deleted and delete them as well

Code:

$sudo find / etc-name "* apache*" | xargs rm-rf

$sudo rm-rf / var/www

$sudo rm-rf / etc/libapache2-mod-jk

3. Delete the association so that you can reinstall it with apt-get install apache2 again

# dpkg-l | grep apache2 | awk'{print $2}'| xargs dpkg-P

Method 2: build Apache from the source

-- split line--

Solution of apache2 [warn] NameVirtualHost *: 80 has no VirtualHosts

Error: [warn] NameVirtualHost *: 80 has no VirtualHosts

Reason: multiple NameVirtualHost defined

Solution: the previous version of Ubuntu is defined in / etc/apache2/sites-available/default, and after 8.04 in / etc/apache2/ports.conf

Therefore, NameVirtualHost *: 80 in / etc/apache2/ports.conf can be commented out.

The essence of this problem is that there is no definition that a domain name can only correspond to one virtual host. Changing NameVirtualHost *: 80 to another port can also be solved.

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

On ubuntu installation apache method to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report