Configuring an Apache Virtual Host on Arch Linux
Home > Tutorial > Configuring an Apache Virtual Host on Arch Linux
Archive
- Installing Apache, MySQL, PHP, and phpMyAdmin on Arch Linux 2021
- Configuring an Apache Virtual Host on Arch Linux Jun 12, 2021
- How to Deploy a Static Blog to GitHub Pages Nov 17, 2026
- How to Sign Up for make.fun with an Agent and Let the Agent Find Bounties on Its Own Nov 17, 2026
- How to Mint Free NFTs on BSC Safely Nov 30, 2026
- How to Make Automated Story YouTube Shorts (Stickman + TTS) Nov 30, 2026
بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
The term Virtual Host refers to the practice of running more than one website (such as company1.example.com and company2.example.com) on a single machine. Virtual hosts can be 'IP-based', meaning you have a different IP address for each website, or 'name-based', meaning you have several names running on each IP address. The fact that they run on the same physical server is invisible to the end user. Apache was one of the first servers to support IP-based virtual hosts directly. Apache version 1.1 and later support both IP-based and name-based virtual hosts (vhosts). The latter variant of virtual hosts is also sometimes called host-based or non-IP virtual hosts.
Configuration
First, edit the file at /etc/httpd/conf/httpd.conf:
sudo nano /etc/httpd/conf/httpd.conf
then uncomment the following line:
Include conf/extra/httpd-vhosts.conf
then configure the hosts file:
sudo /etc/hosts
then create a vhosts folder:
sudo mkdir /etc/httpd/conf/vhosts
next, create a file in the vhosts folder, with the file name matching the name in hosts:
sudo nano /etc/httpd/conf/vhosts/contoh.dom
enable the v-host by adding the following to /etc/httpd/conf/httpd.conf:
Include conf/vhosts/contoh.dom
once done, restart httpd:
sudo systemctl restart httpd
Open http://contoh.dom in your browser:
Hope this helps.
References
- https://wiki.archlinux.org/title/Apache_HTTP_Server#Virtual_hosts
- https://httpd.apache.org/docs/2.4/vhosts/
Like this tutorial? Support the author so there are more free tutorials.
Support via Saweria
Comments