First, need to edit httpd.conf
Sudo vi /opt/lampp/etc/httpd.conf
Around line 487 need to remove the comment and allow httpd-vhosts.conf
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
Then need to create a custom domain in the hosts file.
sudo vi /etc/hosts
127.0.0.1 localhost
127.0.0.5 kingalawaka.com <new line >
#don't touch other existent values
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
This file is used to locate the host.
Then need to create vitual host
sudo vi /opt/lampp/etc/extra/httpd-vhosts.conf
file should look like this
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/opt/lampp/htdocs"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
<Directory "/opt/lampp/htdocs">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin 123pasindumanisha@gmail.com
DocumentRoot "/opt/lampp/htdocs/mysite"
ServerName kingalawaka.com
ServerAlias www.kingalawaka.com
DirectoryIndex index.html
<Directory "/opt/lampp/htdocs/mysite">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Deny,Allow
Allow from all
Require all granted
</Directory>
</virtualHost>
After saving the file
sudo /opt/lampp/lampp restart
if in case Apache service not stopped
sudo netstat -nap | grep :80
this will list down all the processes using port 80. Then from that, using process ID can kill the process.
sudo kill 980
then try to restart the lampp server.