Apache
is one of the most popular web server while Ubuntu
which is based on Debian
is the most popular desktop Linux
distribution. Ubuntu
is increasingly being used for server deployments and Apache
is officially supported with Apache
packages and modules available in its default apt
repository.
Apache
can be installed from the command line using apt
.
apt
's package list from the default repository. $ sudo apt update [sudo] password for user: Hit:1 http://jp.archive.ubuntu.com/ubuntu eoan InRelease Get:2 http://jp.archive.ubuntu.com/ubuntu eoan-updates InRelease [97.5 kB] Get:3 http://jp.archive.ubuntu.com/ubuntu eoan-backports InRelease [88.8 kB] Get:4 http://jp.archive.ubuntu.com/ubuntu eoan-security InRelease [97.5 kB] Fetched 284 kB in 2s (166 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done All packages are up to date.
apache2
package along with dependencies using apt
. $ sudo apt install --assume-yes apache2 Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libjansson4 liblua5.2-0 ssl-cert Suggested packages: apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser openssl-blacklist The following NEW packages will be installed: apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libjansson4 liblua5.2-0 ssl-cert 0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded. Need to get 1,866 kB of archives. After this operation, 8,062 kB of additional disk space will be used. ##### snipped
Apache
options as necessary.$ sudo vi /etc/apache2/apache2.conf
Apache
configuration for errors. $ sudo apachectl configtest AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message Syntax OK
apache2
service once you are done with your configuration. $ sudo systemctl restart apache2
apache2
service to automatically start during system boot.$ sudo systemctl enable apache2 Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable apache2
http
) and 443 (https
) if firewall is enabled. $ sudo ufw allow http Rules updated Rules updated (v6) $ sudo ufw allow https Rules updated Rules updated (v6)
$ curl 127.0.0.1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <!-- Modified from the Debian original for Ubuntu Last updated: 2016-11-16 See: https://launchpad.net/bugs/1288690 --> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Apache2 Ubuntu Default Page: It works</title> <style type="text/css" media="screen"> * { margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; } body, html { ##### snipped
Comment anonymously. Login not required.