Ubuntu Server Installation Apache2
Command: sudo apt-get install apache2
Prompt: Could not reliably determine the server ' s fully qualified domain name, using 127.0.1.1 for ServerName
Workaround:
sudo vi/etc/apache2/apache2.conf
1. After entering the password, enter the edit mode and add ServerName localhost in the blank space.
2. Press ESC and shift+: Enter Wq save and exit the Reference VI editor that you do not understand
3.sudo apache2ctl configtest Start service now displayed as Syntax OK
4.sudo/etc/init.d/apache2 start
One, Apache configuration file description
Ubuntu and Debian have made a lot of customizations to the Apache2 package, and many configuration files have different layouts than the original apache2. The following is a description of each of the configuration files in the/etc/apache2 directory:
*apache2.conf--Global configuration file
*conf.d/--This directory holds some general configuration
*envvars--storage environment variables, generally do not need to modify
*httpd.conf--User Configuration Files
*mods-available/--in this directory are the available modules that are already installed
*mods-enabled/--in this directory is a module that is already enabled
Ports for *PORTS.CONF--HTTPD Services
*sites-available/--virtual hosts available in this directory
*sites-enabled/--The directory is a virtual host that is already enabled
which Apache2.conf is the master configuration file for apache2, which reads all the directories and files listed above (except for the sites-available directory, because Apache does not need to know which virtual hosts are available, it only needs to load those enabled virtual hosts. )
Second, the test is successful
1. You can install a w3m text Web browser in Ubuntu and execute the following command:
sudo apt-get Install w3m
2. Implementation
w3m localhost
When the page appears, the Apache configuration succeeds
Third, public network access
First, you need a public network IP
To access your public IP, the following pages appear:
Description successfully configured
If it fails: The cause may occur:
Server firewall policy is not open 80 port
Workaround:
Set security Group Policy, open port 80.
Linux Server installation apche2 and important configuration