{"id":16861,"date":"2026-05-27T07:04:31","date_gmt":"2026-05-27T07:04:31","guid":{"rendered":"https:\/\/greenwebpage.com\/community\/?p=16861"},"modified":"2026-05-27T07:11:08","modified_gmt":"2026-05-27T07:11:08","slug":"how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts","status":"publish","type":"post","link":"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/","title":{"rendered":"How to Host Multiple Websites on One Server (Name-based Virtual Hosts)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\n  One of the best options for efficiently managing multiple sites on a single Linux server and saving infrastructure costs is to host multiple websites on a single server. Name-based virtual hosts enable multiple web hosts on a single IP address, and they are particularly useful in shared hosting, VPS, development servers, and production web deployments.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Virtual hosting is a web server feature that allows the hosting of multiple websites, applications, landing pages, blogs, and web-based business platforms on a single server, without the need for separate dedicated servers for each domain.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  This is a step-by-step guide that covers all the details needed to install multiple sites on a single Linux server using name-based virtual hosts, configure virtual host files, create directories for your sites, manage your DNS records, run tests, and enhance web hosting security.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Table of Content<\/strong>\n<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#What-Are-Name-based-Virtual-Hosts\">What Are Name-based Virtual Hosts?<\/a><\/li>\n\n\n\n<li><a href=\"#Why-Use-Virtual-Hosts-on-a-Linux-Server\">Why Use Virtual Hosts on a Linux Server?<\/a><\/li>\n\n\n\n<li><a href=\"#post-16861-_e64t4jwn5vdx\">Prerequisites<\/a><\/li>\n\n\n\n<li><a href=\"#Why-Use-Virtual-Hosts-on-a-Linux-Server\">How to Host Multiple Websites on One Server (Name-based Virtual Hosts)<\/a><\/li>\n\n\n\n<li><a href=\"#post-16861-_i6bwegpmawrd\">Common Apache Virtual Host Commands<\/a><\/li>\n\n\n\n<li><a href=\"#post-16861-_7xhgvxhyt3zh\">Best Practices for Hosting Multiple Websites<\/a><\/li>\n\n\n\n<li><a href=\"#post-16861-_yg5flps1439e\">Why Name-based Virtual Hosting Is Popular<\/a><\/li>\n\n\n\n<li><a href=\"#post-16861-_q8hho62oem7r\">Conclusion<\/a><br>  <\/li>\n<\/ul>\n\n\n\n<h2 id=\"What-Are-Name-based-Virtual-Hosts\" class=\"wp-block-heading\"><a id=\"post-16861-_tb1xqdr53zmu\"><\/a><strong>What Are Name-based Virtual Hosts?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Name-based virtual hosting is a technique of <a href=\"https:\/\/greenwebpage.com\/community\/how-to-install-nginx-on-almalinux-10\/\">configuring a web server<\/a> to provide multiple domain names by using the same server IP address. The web server recognizes the hostname specified in the HTTP request header and automatically provides the corresponding content of the requested website.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  For example, a single server can host:\n<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>example1.com<\/li>\n\n\n\n<li>example2.com<\/li>\n\n\n\n<li>blog.example3.com<\/li>\n\n\n\n<li>store.example4.com<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\n  The directories, configurations, and content are unique to each website, but they are all hosted on the same <a href=\"https:\/\/greenwebpage.com\/community\/how-to-install-lemp-stack-on-almalinux-10-with-nginx-mysql-and-php\/\">web server service<\/a> and physical server.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  The main reason for using name-based virtual hosts is that they lower hosting costs, make infrastructure management easier, and improve server utilization.\n<\/p>\n\n\n\n<h2 id=\"Why-Use-Virtual-Hosts-on-a-Linux-Server\" class=\"wp-block-heading\"><a id=\"post-16861-_5qi0f5p6hddl\"><\/a><strong>Why Use Virtual Hosts on a Linux Server?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\n  There are several benefits of virtual hosts in modern web hosting. Having multiple sites on a single server reduces <a href=\"https:\/\/www.greenwebpage.com\/vpshosting.php\">VPS hosting<\/a> costs, simplifies server management, optimizes resource usage, and centralizes website administration. It also enables the deployment of multiple projects without needing to buy additional dedicated servers.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  The following are typical uses of virtual hosts:\n<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Shared hosting environments<\/li>\n\n\n\n<li><a href=\"https:\/\/www.greenwebpage.com\/wordpress-hosting.php\">WordPress hosting<\/a><\/li>\n\n\n\n<li>Development and staging servers<\/li>\n\n\n\n<li>SaaS applications<\/li>\n\n\n\n<li>Business websites<\/li>\n\n\n\n<li>Multi-domain hosting<\/li>\n\n\n\n<li>Web application testing<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Name-based virtual hosting is the standard and most scalable way to configure hosting in most Linux environments.\n<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a id=\"post-16861-_e64t4jwn5vdx\"><\/a><strong>Prerequisites<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Make sure you meet the following requirements before configuring virtual hosts:\n<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A Linux server is installed<\/li>\n\n\n\n<li>The <a href=\"https:\/\/greenwebpage.com\/community\/how-to-install-apache-on-debian-12\/\">Apache web server is installed<\/a><\/li>\n\n\n\n<li>Root or sudo privileges are available<\/li>\n\n\n\n<li>Domain names are configured<\/li>\n\n\n\n<li>DNS records point to the <a href=\"https:\/\/greenwebpage.com\/community\/how-to-set-static-ip-address-on-ubuntu-24-04\/\">server IP address<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/greenwebpage.com\/community\/how-to-set-up-a-basic-firewall-on-almalinux-10-using-firewalld\/\">Firewall access<\/a> for HTTP and HTTPS is enabled<br>  <\/li>\n<\/ul>\n\n\n\n<h2 id=\"Why-Use-Virtual-Hosts-on-a-Linux-Server\" class=\"wp-block-heading\"><a id=\"post-16861-_gvr4v8k0womn\"><\/a><strong>How to Host Multiple Websites on One Server Using Name-Based Virtual Hosts<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Name-based virtual hosts enable multiple websites to be served from a single Linux server and IP address through the use of Apache or <a href=\"https:\/\/greenwebpage.com\/community\/how-to-install-nginx-on-ubuntu-22-04\/\">NGINX<\/a> running multiple site configurations and website directories.\n<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-16861-_6g8dx3xtob5a\"><\/a><strong>Step 1: Install Apache Web Server<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\n  If Apache is not installed, <a href=\"https:\/\/greenwebpage.com\/community\/how-to-install-apache-web-server-on-ubuntu-22-04\/\">install Apache<\/a> with the following command:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo dnf install httpd -y\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\n  To enable the httpd service to run at boot, use the following command:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo systemctl enable httpd\n<\/p><p>\n  sudo systemctl start httpd\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1074\" height=\"259\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-2.png\" alt=\"sudo systemctl enable httpd\" class=\"wp-image-16862\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-2.png 1074w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-2-300x72.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-2-1024x247.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-2-768x185.png 768w\" sizes=\"(max-width: 1074px) 100vw, 1074px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Check the status of the Apache service:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo systemctl status httpd\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1071\" height=\"514\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-3.png\" alt=\"sudo systemctl status httpd\" class=\"wp-image-16863\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-3.png 1071w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-3-300x144.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-3-1024x491.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-3-768x369.png 768w\" sizes=\"(max-width: 1071px) 100vw, 1071px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-16861-_yho8ohv8is13\"><\/a><strong>Step 2: Configure Firewall Access<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Enable HTTP &amp; HTTPS ports on the <a href=\"https:\/\/greenwebpage.com\/community\/how-to-check-firewall-status-on-debian-13\/\">Linux firewall<\/a>.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Allow HTTP:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo firewall-cmd &#8211;permanent &#8211;add-service=http\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1074\" height=\"135\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-4.png\" alt=\"  sudo firewall-cmd --permanent --add-service=http\n\" class=\"wp-image-16864\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-4.png 1074w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-4-300x38.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-4-1024x129.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-4-768x97.png 768w\" sizes=\"(max-width: 1074px) 100vw, 1074px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Allow HTTPS:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo firewall-cmd &#8211;permanent &#8211;add-service=https\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1068\" height=\"132\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-5.png\" alt=\"  sudo firewall-cmd --permanent --add-service=https\n\" class=\"wp-image-16865\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-5.png 1068w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-5-300x37.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-5-1024x127.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-5-768x95.png 768w\" sizes=\"(max-width: 1068px) 100vw, 1068px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Reload the firewall:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo firewall-cmd &#8211;reload\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1061\" height=\"127\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-6.png\" alt=\"  sudo firewall-cmd --reload\n\" class=\"wp-image-16866\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-6.png 1061w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-6-300x36.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-6-1024x123.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-6-768x92.png 768w\" sizes=\"(max-width: 1061px) 100vw, 1061px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Verify firewall services:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo firewall-cmd &#8211;list-services\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1073\" height=\"127\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-7.png\" alt=\"  sudo firewall-cmd --list-services\n\" class=\"wp-image-16867\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-7.png 1073w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-7-300x36.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-7-1024x121.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-7-768x91.png 768w\" sizes=\"(max-width: 1073px) 100vw, 1073px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-16861-_md7ez5yjlies\"><\/a><strong>Step 3: Create Website Directory Structures<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Every website should have its own set of document root directories.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Follow the steps below to create directories for the first website:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo mkdir -p \/var\/www\/example1.com\/public_html\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1069\" height=\"135\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-8.png\" alt=\"  sudo mkdir -p \/var\/www\/example1.com\/public_html\n\" class=\"wp-image-16868\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-8.png 1069w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-8-300x38.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-8-1024x129.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-8-768x97.png 768w\" sizes=\"(max-width: 1069px) 100vw, 1069px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  You can create the directory in the following way:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo mkdir -p \/var\/www\/example2.com\/public_html\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1071\" height=\"112\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-9.png\" alt=\"  sudo mkdir -p \/var\/www\/example2.com\/public_html\n\" class=\"wp-image-16869\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-9.png 1071w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-9-300x31.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-9-1024x107.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-9-768x80.png 768w\" sizes=\"(max-width: 1071px) 100vw, 1071px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Set proper ownership permissions:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo chown -R $USER:$USER \/var\/www\/example1.com\n<\/p><p>\n  sudo chown -R $USER:$USER \/var\/www\/example2.com\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1072\" height=\"161\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-10.png\" alt=\"  sudo chown -R $USER:$USER \/var\/www\/example1.com\n\" class=\"wp-image-16870\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-10.png 1072w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-10-300x45.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-10-1024x154.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-10-768x115.png 768w\" sizes=\"(max-width: 1072px) 100vw, 1072px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Set directory permissions:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo chmod -R 755 \/var\/www\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1073\" height=\"105\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-11.png\" alt=\"  sudo chmod -R 755 \/var\/www\n\" class=\"wp-image-16871\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-11.png 1073w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-11-300x29.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-11-1024x100.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-11-768x75.png 768w\" sizes=\"(max-width: 1073px) 100vw, 1073px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-16861-_bkw5aikz528h\"><\/a><strong>Step 4: Create Sample Website Pages<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Build a sample index page for website 1:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  nano \/var\/www\/example1.com\/public_html\/index.html\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Add the following content:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  &lt;h1&gt;Welcome to Example1.com&lt;\/h1&gt;\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1070\" height=\"171\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-12.png\" alt=\"\/var\/www\/example.com\/public_html\/index.html\" class=\"wp-image-16872\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-12.png 1070w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-12-300x48.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-12-1024x164.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-12-768x123.png 768w\" sizes=\"(max-width: 1070px) 100vw, 1070px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Make a sample page for the second website:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  nano \/var\/www\/example2.com\/public_html\/index.html\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Add the following content:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  &lt;h1&gt;Welcome to Example2.com&lt;\/h1&gt;\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1067\" height=\"157\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-13.png\" alt=\"\/var\/www\/example2.com\/public_html\/index.html\" class=\"wp-image-16873\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-13.png 1067w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-13-300x44.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-13-1024x151.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-13-768x113.png 768w\" sizes=\"(max-width: 1067px) 100vw, 1067px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  These test pages check the functionality of <a href=\"https:\/\/greenwebpage.com\/community\/how-to-configure-network-settings-on-almalinux-10\/\">virtual host configurations<\/a>.\n<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-16861-_e0173ct2eqji\"><\/a><strong>Step 5: Create Apache Virtual Host Configuration Files<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\n  The final step is to write the Apache Virtual Host configuration files. The way each domain is served is determined by its virtual host file in Apache.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Set up the initial virtualhost configuration:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo nano \/etc\/httpd\/conf.d\/example1.com.conf\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Add the following configuration:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  &lt;VirtualHost *:80&gt;\n<\/p><p>\n      ServerAdmin admin@example1.com\n<\/p><p>\n      ServerName example1.com\n<\/p><p>\n      ServerAlias www.example1.com\n<\/p><p>\n      DocumentRoot \/var\/www\/example1.com\/public_html\n<\/p><p>\n      ErrorLog \/var\/log\/httpd\/example1-error.log\n<\/p><p>\n      CustomLog \/var\/log\/httpd\/example1-access.log combined\n<\/p><p>\n  &lt;\/VirtualHost&gt;\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1077\" height=\"498\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-14.png\" alt=\"\/etc\/httpd\/conf.d\/example.com.conf\" class=\"wp-image-16874\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-14.png 1077w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-14-300x139.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-14-1024x473.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-14-768x355.png 768w\" sizes=\"(max-width: 1077px) 100vw, 1077px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Create the second virtual host configuration:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo nano \/etc\/httpd\/conf.d\/example2.com.conf\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Add the following configuration:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  &lt;VirtualHost *:80&gt;\n<\/p><p>\n      ServerAdmin admin@example2.com\n<\/p><p>\n      ServerName example2.com\n<\/p><p>\n      ServerAlias www.example2.com\n<\/p><p>\n      DocumentRoot \/var\/www\/example2.com\/public_html\n<\/p><p>\n      ErrorLog \/var\/log\/httpd\/example2-error.log\n<\/p><p>\n      CustomLog \/var\/log\/httpd\/example2-access.log combined\n<\/p><p>\n  &lt;\/VirtualHost&gt;\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1078\" height=\"352\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-15.png\" alt=\"\/etc\/httpd\/conf.d\/example2.com.conf\" class=\"wp-image-16875\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-15.png 1078w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-15-300x98.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-15-1024x334.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-15-768x251.png 768w\" sizes=\"(max-width: 1078px) 100vw, 1078px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Each virtual host configuration points Apache to the correct website directory based on the requested domain name.\n<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-16861-_7b5h1m92wut9\"><\/a><strong>Step 6: Test Apache Configuration<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Check the syntax of the configuration before trying to start Apache.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Run the following command:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo apachectl configtest\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1073\" height=\"231\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-16.png\" alt=\"sudo apachectl configtest\" class=\"wp-image-16876\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-16.png 1073w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-16-300x65.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-16-1024x220.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-16-768x165.png 768w\" sizes=\"(max-width: 1073px) 100vw, 1073px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  A test of the configuration can be used to avoid startup problems with Apache due to syntax errors.\n<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-16861-_3klwsp43ruvk\"><\/a><strong>Step 7: Restart the Apache Web Server<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Restart Apache to apply the new virtual host configurations.\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo systemctl restart httpd\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1072\" height=\"105\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-17.png\" alt=\"sudo systemctl restart httpd\" class=\"wp-image-16877\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-17.png 1072w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-17-300x29.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-17-1024x100.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-17-768x75.png 768w\" sizes=\"(max-width: 1072px) 100vw, 1072px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Verify Apache status:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  sudo systemctl status httpd\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1069\" height=\"675\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-18.png\" alt=\"sudo systemctl status httpd\" class=\"wp-image-16878\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-18.png 1069w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-18-300x189.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-18-1024x647.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-18-768x485.png 768w\" sizes=\"(max-width: 1069px) 100vw, 1069px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  The service should remain active and running.\n<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-16861-_tw7ztiv5w9td\"><\/a><strong>Step 8: Configure DNS Records<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\n  For virtual hosts to work properly, the domain <a href=\"https:\/\/greenwebpage.com\/community\/how-to-flush-local-dns-cache-on-linux\/\">DNS records<\/a> must point to the server&#8217;s IP address.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Make the following DNS records with your domain provider:\n<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A record for example1.com<\/li>\n\n\n\n<li>A record for www.example1.com<\/li>\n\n\n\n<li>A record for example2.com<\/li>\n\n\n\n<li>A record for www.example2.com<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\n  All records should be pointing towards the same server IP address. The DNS propagation usually takes a few minutes to hours, depending on the DNS provider.\n<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-16861-_qw16347bqsi1\"><\/a><strong>Step 9: Test Multiple Websites on the Server<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Open each domain in a web browser:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p>\n  http:\/\/example1.com\n<\/p><p>\n  http:\/\/example2.com\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1127\" height=\"677\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-19.png\" alt=\"http:\/\/example.com\" class=\"wp-image-16879\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-19.png 1127w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-19-300x180.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-19-1024x615.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/word-image-16861-19-768x461.png 768w\" sizes=\"(max-width: 1127px) 100vw, 1127px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Each domain should display its respective website content. If both websites load correctly, the name-based virtual host configuration is working successfully.\n<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a id=\"post-16861-_i6bwegpmawrd\"><\/a><strong>Common Apache Virtual Host Commands<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><p><strong>Task<\/strong>\n<\/p><\/td><td><p><strong>Command<\/strong>\n<\/p><\/td><\/tr><tr><td><p>\n  Install Apache\n<\/p><\/td><td><p>\n  sudo dnf install httpd -y\n<\/p><\/td><\/tr><tr><td><p>\n  Start Apache\n<\/p><\/td><td><p>\n  sudo systemctl start httpd\n<\/p><\/td><\/tr><tr><td><p>\n  Enable Apache\n<\/p><\/td><td><p>\n  sudo systemctl enable httpd\n<\/p><\/td><\/tr><tr><td><p>\n  Restart Apache\n<\/p><\/td><td><p>\n  sudo systemctl restart httpd\n<\/p><\/td><\/tr><tr><td><p>\n  Test Apache config\n<\/p><\/td><td><p>\n  sudo apachectl configtest\n<\/p><\/td><\/tr><tr><td><p>\n  Reload firewall\n<\/p><\/td><td><p>\n  sudo firewall-cmd &#8211;reload\n<\/p><\/td><\/tr><tr><td><p>\n  Check Apache status\n<\/p><\/td><td><p>\n  sudo systemctl status httpd\n<\/p><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><a id=\"post-16861-_uft9lpxyk3kc\"><\/a><a id=\"post-16861-_7xhgvxhyt3zh\"><\/a>\n<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Best Practices for Hosting Multiple Websites<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Each website should use separate directories, log files, and configuration files to improve organization and security. Administrators should also use SSL certificates, <a href=\"https:\/\/greenwebpage.com\/community\/how-to-install-ufw-on-ubuntu-22-04\/\">enable firewall protection<\/a>, keep Apache updated, and monitor server logs regularly.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Using HTTPS encryption with Let&#8217;s Encrypt certificates improves browser trust and helps websites perform better in search engine rankings.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  For production hosting environments, administrators should also implement regular backups, malware scanning, and server monitoring.\n<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a id=\"post-16861-_yg5flps1439e\"><\/a><strong>Why Name-based Virtual Hosting Is Popular<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Name-based virtual hosting is widely used because it allows businesses and developers to host multiple domains efficiently on a single server. This approach reduces infrastructure costs while maintaining flexibility, scalability, and centralized administration.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Modern Linux hosting environments rely heavily on virtual hosts because they simplify multi-domain deployments for <a href=\"https:\/\/greenwebpage.com\/community\/how-to-install-wordpress-with-apache-on-ubuntu-24-04\/\">WordPress hosting<\/a>, SaaS applications, development environments, and enterprise websites.\n<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a id=\"post-16861-_q8hho62oem7r\"><\/a><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Name-based virtual hosts are an effective and scalable solution for today&#8217;s web hosting needs when multiple sites are running on a <a href=\"https:\/\/greenwebpage.com\/community\/how-to-optimize-a-linux-server-for-maximum-performance-in-2026\/\">single Linux server<\/a>. Apache virtual host configurations enable administrators to handle multiple domains effectively, while ensuring secure resource sharing.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  Hosting multiple websites on one server (name-based virtual hosting) lets your web server check the incoming domain name and route visitors to the correct site files.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n  By creating separate website directories, configuring Apache virtual hosts, enabling HTTPS encryption, and securing the server with a firewall, administrators can build a reliable, production-ready hosting environment.\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n    <div class=\"xs_social_share_widget xs_share_url after_content \t\tmain_content  wslu-style-1 wslu-share-box-shaped wslu-fill-colored wslu-none wslu-share-horizontal wslu-theme-font-no wslu-main_content\">\n\n\t\t\n        <ul>\n\t\t\t        <\/ul>\n    <\/div> \n","protected":false},"excerpt":{"rendered":"<p>One of the best options for efficiently managing multiple sites on a single Linux server and saving infrastructure costs is to host multiple websites on a single server. Name-based virtual hosts enable multiple web hosts on a single IP address, and they are particularly useful in shared hosting, VPS, development servers, and production web deployments. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":16886,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"class_list":["post-16861","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Host Multiple Websites on One Server (Name-based Virtual Hosts) - Greenwebpage Community<\/title>\n<meta name=\"description\" content=\"This is a step-by-step guide that covers all the details needed to install multiple sites on a single Linux server using name-based virtual hosts, configure virtual host files, create directories for your sites, manage your DNS records, run tests, and enhance web hosting security.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Host Multiple Websites on One Server (Name-based Virtual Hosts) - Greenwebpage Community\" \/>\n<meta property=\"og:description\" content=\"This is a step-by-step guide that covers all the details needed to install multiple sites on a single Linux server using name-based virtual hosts, configure virtual host files, create directories for your sites, manage your DNS records, run tests, and enhance web hosting security.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/\" \/>\n<meta property=\"og:site_name\" content=\"Greenwebpage Community\" \/>\n<meta property=\"article:published_time\" content=\"2026-05-27T07:04:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-27T07:11:08+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/How-to-hosts-multiple-websites-on-one-server.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Karim Buzdar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Karim Buzdar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/\"},\"author\":{\"name\":\"Karim Buzdar\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8\"},\"headline\":\"How to Host Multiple Websites on One Server (Name-based Virtual Hosts)\",\"datePublished\":\"2026-05-27T07:04:31+00:00\",\"dateModified\":\"2026-05-27T07:11:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/\"},\"wordCount\":1389,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#organization\"},\"image\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/How-to-hosts-multiple-websites-on-one-server.jpg\",\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/\",\"url\":\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/\",\"name\":\"How to Host Multiple Websites on One Server (Name-based Virtual Hosts) - Greenwebpage Community\",\"isPartOf\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/How-to-hosts-multiple-websites-on-one-server.jpg\",\"datePublished\":\"2026-05-27T07:04:31+00:00\",\"dateModified\":\"2026-05-27T07:11:08+00:00\",\"description\":\"This is a step-by-step guide that covers all the details needed to install multiple sites on a single Linux server using name-based virtual hosts, configure virtual host files, create directories for your sites, manage your DNS records, run tests, and enhance web hosting security.\",\"breadcrumb\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#primaryimage\",\"url\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/How-to-hosts-multiple-websites-on-one-server.jpg\",\"contentUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/How-to-hosts-multiple-websites-on-one-server.jpg\",\"width\":1020,\"height\":600,\"caption\":\"How to hosts multiple websites on one server\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/greenwebpage.com\/community\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Host Multiple Websites on One Server (Name-based Virtual Hosts)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#website\",\"url\":\"https:\/\/greenwebpage.com\/community\/\",\"name\":\"Greenwebpage Community\",\"description\":\"Get online in three steps with our wide range of web hosting solutions. Choose from professional business to enterprise options designed to meet your needs.\",\"publisher\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/greenwebpage.com\/community\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#organization\",\"name\":\"Greenwebpage Community\",\"url\":\"https:\/\/greenwebpage.com\/community\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png\",\"contentUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png\",\"width\":512,\"height\":512,\"caption\":\"Greenwebpage Community\"},\"image\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8\",\"name\":\"Karim Buzdar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g\",\"caption\":\"Karim Buzdar\"},\"sameAs\":[\"https:\/\/greenwebpage.com\"],\"url\":\"https:\/\/greenwebpage.com\/community\/author\/karim\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Host Multiple Websites on One Server (Name-based Virtual Hosts) - Greenwebpage Community","description":"This is a step-by-step guide that covers all the details needed to install multiple sites on a single Linux server using name-based virtual hosts, configure virtual host files, create directories for your sites, manage your DNS records, run tests, and enhance web hosting security.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/","og_locale":"en_US","og_type":"article","og_title":"How to Host Multiple Websites on One Server (Name-based Virtual Hosts) - Greenwebpage Community","og_description":"This is a step-by-step guide that covers all the details needed to install multiple sites on a single Linux server using name-based virtual hosts, configure virtual host files, create directories for your sites, manage your DNS records, run tests, and enhance web hosting security.","og_url":"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/","og_site_name":"Greenwebpage Community","article_published_time":"2026-05-27T07:04:31+00:00","article_modified_time":"2026-05-27T07:11:08+00:00","og_image":[{"width":1020,"height":600,"url":"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/How-to-hosts-multiple-websites-on-one-server.jpg","type":"image\/jpeg"}],"author":"Karim Buzdar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Karim Buzdar","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#article","isPartOf":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/"},"author":{"name":"Karim Buzdar","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8"},"headline":"How to Host Multiple Websites on One Server (Name-based Virtual Hosts)","datePublished":"2026-05-27T07:04:31+00:00","dateModified":"2026-05-27T07:11:08+00:00","mainEntityOfPage":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/"},"wordCount":1389,"commentCount":0,"publisher":{"@id":"https:\/\/greenwebpage.com\/community\/#organization"},"image":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#primaryimage"},"thumbnailUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/How-to-hosts-multiple-websites-on-one-server.jpg","articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/","url":"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/","name":"How to Host Multiple Websites on One Server (Name-based Virtual Hosts) - Greenwebpage Community","isPartOf":{"@id":"https:\/\/greenwebpage.com\/community\/#website"},"primaryImageOfPage":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#primaryimage"},"image":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#primaryimage"},"thumbnailUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/How-to-hosts-multiple-websites-on-one-server.jpg","datePublished":"2026-05-27T07:04:31+00:00","dateModified":"2026-05-27T07:11:08+00:00","description":"This is a step-by-step guide that covers all the details needed to install multiple sites on a single Linux server using name-based virtual hosts, configure virtual host files, create directories for your sites, manage your DNS records, run tests, and enhance web hosting security.","breadcrumb":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#primaryimage","url":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/How-to-hosts-multiple-websites-on-one-server.jpg","contentUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2026\/05\/How-to-hosts-multiple-websites-on-one-server.jpg","width":1020,"height":600,"caption":"How to hosts multiple websites on one server"},{"@type":"BreadcrumbList","@id":"https:\/\/greenwebpage.com\/community\/how-to-host-multiple-websites-on-one-server-name-based-virtual-hosts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/greenwebpage.com\/community\/"},{"@type":"ListItem","position":2,"name":"How to Host Multiple Websites on One Server (Name-based Virtual Hosts)"}]},{"@type":"WebSite","@id":"https:\/\/greenwebpage.com\/community\/#website","url":"https:\/\/greenwebpage.com\/community\/","name":"Greenwebpage Community","description":"Get online in three steps with our wide range of web hosting solutions. Choose from professional business to enterprise options designed to meet your needs.","publisher":{"@id":"https:\/\/greenwebpage.com\/community\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/greenwebpage.com\/community\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/greenwebpage.com\/community\/#organization","name":"Greenwebpage Community","url":"https:\/\/greenwebpage.com\/community\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/","url":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png","contentUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png","width":512,"height":512,"caption":"Greenwebpage Community"},"image":{"@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8","name":"Karim Buzdar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g","caption":"Karim Buzdar"},"sameAs":["https:\/\/greenwebpage.com"],"url":"https:\/\/greenwebpage.com\/community\/author\/karim\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts\/16861","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/comments?post=16861"}],"version-history":[{"count":4,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts\/16861\/revisions"}],"predecessor-version":[{"id":16885,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts\/16861\/revisions\/16885"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/media\/16886"}],"wp:attachment":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/media?parent=16861"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/categories?post=16861"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/tags?post=16861"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}