AccuWeb Hosting

VPS Hosting

VIRTUAL PRIVATE SERVERS
Full root access and guaranteed resources.
APPS ON A VPS
Deploy popular applications on your own server.
All applications

More Services

AI Website & Store Builder
Build a website or online store with AI.
Start
WEB & WORDPRESS HOSTING
For websites, blogs and online stores.
RESELLER & AGENCY
DOMAINS, SECURITY & EMAIL
Domain names, protection and professional email.

Hosting Articles

Setting up Apache for Multi Domain Hosting
- VirtualHost Directive

If you want to set up your Apache Web server for multiple domains and sub-domains (e.g., www.company_x.com and XYZ.company_x.com), you can do so with the VirtualHost directive.

It's not very difficult, but there are some subtle aspects that may cause you problems the first time.In this article, I will discuss how to set up virtual hosting. Most of the information available around the net is confusing. Hopefully, this page will simplify the process a bit.

How Apache Works (How it resolves browser requests?

When Apache is started, it scans the configuration file (/etc/httpd/conf/httpd.conf) to determine its settings. Based on the configuration file, Apache generates a table of the server's IP addresses with a vhost address set containing the associated domain names. Now apache deamon is ready to listen any request on web server port mostly number 80.

Now, when browser sends the document request along with the original domain name to the IP address, your httpd.conf file listen to this request. if it has been configured for vhosts, it will compare the client's request to the ServerName of each vhost with the same IP address and port. The vhost block of directives of the first ServerName that matches the client's request will be applied.

Within a vhost block (i.e., directives between <VirtualHost> tags) there are many directives that may be given, but only two are required: the ServerName and the DocumentRoot directives. The ServerName directive provides the domain name and the sub-domain name. The DocumentRoot directive sets the root directory for the domain. If Apache finds a vhost with a ServerName that matches a client request, it will look in the root directory specified by the DocumentRoot directive for files, thus giving the appearance of a separate server.

(Posted By Jason)