You are on page 1of 2

Sure, here are the configuration files for two websites, one located in /var/www/html

and the other in /Linux/mywebsite, using httpd:

Code snippet
/etc/httpd/conf.d/example.com.conf

Code snippet
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
</VirtualHost>

Code snippet
/etc/httpd/conf.d/mywebsite.conf

Code snippet
<VirtualHost *:80>
ServerName mywebsite
DocumentRoot /Linux/mywebsite
</VirtualHost>

To access these websites in a browser, you need to enter their hostnames into the
address bar. For example, to access the website located in /var/www/html, you would
enter example.com into the address bar. To access the website located in
/Linux/mywebsite, you would enter mywebsite into the address bar.

Once you have entered the hostname into the address bar, press Enter and the
website should load in your browser.

Here are some additional things to keep in mind when accessing websites hosted on a
local machine:

● You may need to enable the httpd module for name-based virtual hosting. This
can be done by editing the httpd configuration file and adding the following line to
the end of the file:

Code snippet
LoadModule mod_vhost_alias.so

● You may also need to set the AllowOverride directive to All in the httpd
configuration file. This can be done by editing the httpd configuration file and
adding the following line to the end of the file:

Code snippet
AllowOverride All

Once you have made these changes, you should be able to access your websites by
entering their hostnames into a web browser.

Sources
1. https://zombiesecured.com/html/howTo/Apache/Fedora/Step2b-Prep.html

You might also like