How to create a virtual host in fedora.

Solved:

First: Create a file at /etc/httpd/conf.d/ location with .conf extension and insert the following code block.

<virtualhost *:80>
   DocumentRoot “/var/www/project-folder”
   ServerName domain-name

   <Directory “/var/www/project-folder”>
       Options Indexes FollowSymLinks
       AllowOverride All
       Require all granted
   </Directory>
</virtualhost>

Second: create a project under /var/www/     named “project-folder” as virtualhost DocumentRoot.

Insert the domain in hosts file at /etc/hosts as

127.0.0.1 domain

Finally: Restart the httpd service

$ systemctl restart httpd

Browse the domain in browser.

Enjoy.

Leave a Reply

Your email address will not be published. Required fields are marked *