Install Apache on Ubuntu with sudo apt install apache2, then configure sites under /etc/apache2/. This guide walks through the Ubuntu package, configuration layout, a named virtual host, HTTPS, safe file permissions, and a practical troubleshooting sequence.
Install Apache2 on Ubuntu
Ubuntu’s documented package-based installation is:
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
GEEKOM Air12 Budget Mini PC Office,Intel 7505,8GB RAM(64GB Max),256GB SSD | $349.00 | Buy on Amazon |
sudo apt install apache2
Ubuntu packages the server as apache2; installing through APT is the standard Ubuntu route. The exact Apache version depends on your Ubuntu release and package sources, so check your system’s package information if you need that version.
Ubuntu’s guides describe configuration changes to the main files as taking effect when Apache starts or restarts. After making a change, validate the configuration before applying it:
#1 Best Overall
- ➊ [ Trusted Quality for Everyday Agentic AI ] GEEKOM equips its SSDs with reliable original-grade flash and conducts rigorous stability testing to support dependable everyday operation. This commitment to quality is backed by a 3-year warranty. Simply connect the Air12 to cloud AI services for research, writing, study support and daily productivity—no NPU or complex local setup required. Designed for students, home users, light office work and first-time buyers, the Air12 is a high-value Cloud Agentic PC for everyday tasks
- ➋ [ Intel 7505 processor ] Powered by the Intel 7505 processor (2 cores, 4 threads, up to 3.5GHz), the GEEKOM Mini PC Air12 delivers smooth performance for everyday computing, office tasks, and home entertainment. With enhanced single-core processing, it handles daily workloads efficiently and responsively. Compact, quiet, and energy-efficient — a solid alternative to bulky desktops.
- ➌ [440lbs(200kg) Pressure Rated Metal Frame for Demanding Environments] Unlike the Plastic Shells You’ll Find on Most Mini PCs, geekom Mini Air12 features a triple-reinforced ABS+PC shell, precision-crafted metal frame and baseplate—engineered to withstand up to 440 lbs of pressure for the perfect balance of strength and thermal efficiency. Tool-free upgrades, shock-absorbing feet, and a 3D antenna deliver true durability
- ➍ [Dual-Channel RAM & NVMe SSD Expandability] Ships with 8GB DDR4 RAM and a 256GB NVMe SSD for smooth everyday performance. Dual memory slots and dual storage slots give you the flexibility to upgrade to 64GB RAM and 2TB SSD, so your system can adapt as your workload grows. Enjoy faster load times, smoother multitasking, and long-term reliability.
- ➎ [Triple 4K Displays for Maximum Productivity] Connect up to three 4K monitors via HDMI 2.0, Mini DisplayPort 1.4, and USB-C — ideal for stock trading dashboards, multi-tab research, office document editing, and light spreadsheet work. WiFi 6 and Bluetooth with high-gain antenna ensure stable wireless connections throughout your workspace. 5x USB ports and a full-size SD card reader provide quick access to peripherals and camera files — no adapters required.
sudo apachectl configtest
A successful test reports Syntax OK. Then restart the service when the change requires it:
sudo systemctl restart apache2.service
Understand Ubuntu’s Apache configuration tree
The main global configuration file is /etc/apache2/apache2.conf. Modern Ubuntu uses the /etc/apache2/ tree rather than the old httpd.conf arrangement as its default layout.
| Path | Purpose |
|---|---|
/etc/apache2/apache2.conf |
Main global configuration. |
/etc/apache2/sites-available/ |
Virtual-host configuration files that are available to enable. |
/etc/apache2/sites-enabled/ |
Links to site configurations currently enabled. |
/etc/apache2/mods-available/ and /etc/apache2/mods-enabled/ |
Module configurations, separated into available and enabled sets. |
/etc/apache2/conf-available/ and /etc/apache2/conf-enabled/ |
General configuration snippets, separated into available and enabled sets. |
/etc/apache2/ports.conf |
Listener directives, including the documented default listener on port 80. |
Use a2ensite and a2dissite to enable or disable sites rather than treating the two site directories as interchangeable. The default site file is /etc/apache2/sites-available/000-default.conf, and its documented document root is /var/www/html. See Ubuntu’s Apache2 installation guide for the configuration layout.
Choose the site and listener setup
One site or multiple hostnames
A single default virtual host can serve one site. If the machine serves multiple hostnames, create separate name-based virtual hosts so each hostname can map to its own settings and document root. This makes the mapping and ongoing maintenance clearer; use distinct site configurations when that organization is useful for your deployment. Apache’s Virtual Host documentation explains the model and how Apache selects a host.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Public-facing or loopback-only listener
Listener configuration belongs in /etc/apache2/ports.conf. An unspecified address listens on the machine’s assigned addresses; binding to 127.0.0.1:80 restricts access to the local machine. Choose based on intended reachability: a public site needs an appropriate externally reachable listener and network/firewall configuration, while a service intended to be reached only through a local reverse proxy may use loopback. A listener determines where Apache accepts connections, not which files it serves.
Create and enable a named virtual host
For an example hostname of example.com, create the document-root directory and a site configuration. Replace the example hostname and paths with values for your site.
-
Create the site directory:
sudo mkdir -p /var/www/example.com -
Create
/etc/apache2/sites-available/mysite.confwith a virtual-host definition like this:<VirtualHost *:80> ServerName example.com ServerAlias www.example.com DocumentRoot /var/www/example.com <Directory /var/www/example.com> Require all granted </Directory> </VirtualHost>Set
ServerNameto the primary hostname and includeServerAliasonly for additional hostnames this site should answer to.DocumentRootmust point to the directory containing the site files. The directory rule allows requests to that directory; ensure the filesystem permissions also allow Apache to read it.Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallSpecial offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Place your site content in the document root and check that Apache can read the directory and files.
-
Enable the site using its filename without the
.confsuffix, test the configuration, and restart Apache:sudo a2ensite mysite sudo apachectl configtest sudo systemctl restart apache2.service
Ubuntu’s Apache2 settings guide documents site configuration and activation. Requests whose hostname does not match a configured ServerName or alias are handled by the default virtual host, which acts as the fallback.
To disable the example site while troubleshooting, run:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
sudo a2dissite mysite
sudo systemctl restart apache2.service
Apache’s DocumentRoot controls the content directory; listener settings control network reachability. Request logging is separate: Ubuntu documents /var/log/apache2/access.log as the default access log. For directory requests, Apache checks configured DirectoryIndex filenames, including index.html in Ubuntu’s documented default list. If no index file exists, behavior depends on directory options and permissions; do not enable directory listings as a default.
Enable HTTPS
HTTPS requires the SSL module, an enabled TLS virtual host, and a certificate and private key configured for that site. Ubuntu documents the default SSL site as a starting point:
-
Enable the SSL module:
sudo a2enmod ssl -
Enable Ubuntu’s default SSL site:
sudo a2ensite default-ssl -
Configure the TLS virtual host’s
SSLCertificateFileandSSLCertificateKeyFiledirectives with paths to the certificate and matching private key for your site. -
Test and restart:
sudo apachectl configtest sudo systemctl restart apache2.service
The certificate and key generated by the ssl-cert package are suitable for testing, not as a replacement for a certificate specific to the site or server. The configured paths must point to the certificate and key Apache is meant to use. Ubuntu’s Apache2 modules guide covers SSL setup and certificate guidance.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteRedirect HTTP visitors to HTTPS
Only add the redirect after the HTTPS virtual host and certificate are working. Apache 2.4 documents a dedicated port-80 virtual host with a permanent redirect as the preferred approach in the described situation. For example, the HTTP virtual host can contain:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
Redirect permanent / https://example.com/
</VirtualHost>
Use the hostname that should be canonical for your site, and ensure any aliases are handled intentionally. Apache’s redirecting and remapping documentation discusses this approach.
Set document-root permissions safely
Apache’s worker process runs as www-data. Ubuntu’s warning is explicit: “The apache2 daemon will run as the www-data user, which has a corresponding www-data group. These should not be granted write access to the document root, as this would mean that vulnerabilities in Apache or the applications it is serving would allow attackers to overwrite the served content.” — Ubuntu Server documentation, “How to use Apache2 modules.”
Keep the web server account able to read served files without granting it write access to the document root. If multiple trusted editors need to update files, Ubuntu demonstrates using a separate shared group rather than making www-data the writer. Adapt ownership and permissions to the deployment; broad recursive permission changes can alter an existing production site’s access model.
Recommended Free Tools
Troubleshoot a site that does not respond as expected
-
Confirm the site file is in
sites-available/and enabled insites-enabled/. Enable it withsudo a2ensite mysiteif needed, then test and restart. -
Compare the request’s hostname, path, and port with the site’s
ServerName,ServerAlias,DocumentRoot, and the listener inports.conf. -
Inspect Apache’s parsed virtual-host map with:
sudo apachectl -SThis can reveal which virtual host Apache associates with a hostname and which one is the fallback. If a site conflict is responsible, disable the conflicting site with
a2dissiteand restart. -
Check the site’s configured logs. The documented default access log is
/var/log/apache2/access.log; a site may have its own configured log paths.Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
For HTTPS, check that the SSL module and TLS site are enabled and that the certificate and key paths in that site’s configuration are correct.
For exact package details and release-specific behavior, consult the documentation for your Ubuntu release and its installed Apache package.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




