{"id":2217,"date":"2014-08-13T16:59:48","date_gmt":"2014-08-13T12:59:48","guid":{"rendered":"https:\/\/blog.alwawee.ru\/?p=2217"},"modified":"2014-08-13T16:59:48","modified_gmt":"2014-08-13T12:59:48","slug":"apache-config-file-multiple-virtualhosts","status":"publish","type":"post","link":"https:\/\/blog.alwawee.ru\/?p=2217","title":{"rendered":"Apache config file with multiple VirtualHosts"},"content":{"rendered":"<p>I wanted to be able to open sites like <strong>*.ladby.ru<\/strong> and <strong>*.lovecakes.ru<\/strong> besides main sites <strong>ladby.ru<\/strong> and <strong>lovecakes.ru<\/strong>. This is how I solved this problem &#8211; by editing Apache config file, making it much simpler and by using ServerNames instead of ServerAliases. <\/p>\n<pre>\r\n<VirtualHost *:80>\r\n  \tServerName www.lovecakes.ru\r\n  \tDocumentRoot \/var\/www\/lovecakes.ru\/public\/\r\n<\/VirtualHost>\r\n\r\n<VirtualHost *:80>\r\n\tServerName galina.lovecakes.ru\r\n  \tDocumentRoot \/var\/www\/galina.lovecakes.ru\/public\/\r\n<\/VirtualHost>\r\n\r\n<VirtualHost *:80>\r\n\tServerName www.ladby.ru\r\n  \tDocumentRoot \/var\/www\/ladby.ru\/public\/\r\n<\/VirtualHost>\r\n\r\n<VirtualHost *:80>\r\n\tServerName ladby.ru\r\n  \tDocumentRoot \/var\/www\/ladby.ru\/public\/\r\n<\/VirtualHost>\r\n\r\n<VirtualHost *:80>\r\n \tServerName club.ladby.ru\r\n  \tDocumentRoot \/var\/www\/club.ladby.ru\/public\/\r\n<\/VirtualHost>\r\n<\/pre>\n<p>And this is how the tree looks like:<br \/>\n<a href=\"https:\/\/blog.alwawee.ru\/wp-content\/uploads\/2014\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-2014-08-13-\u0432-16.57.17.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.alwawee.ru\/wp-content\/uploads\/2014\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-2014-08-13-\u0432-16.57.17.png\" alt=\"\u0421\u043d\u0438\u043c\u043e\u043a \u044d\u043a\u0440\u0430\u043d\u0430 2014-08-13 \u0432 16.57.17\" width=\"274\" height=\"153\" class=\"aligncenter size-full wp-image-2218\" \/><\/a><\/p>\n<p>Do not forget to reload Apache after editing conf file, which lies here: <strong>\/etc\/apache2\/sites-available<\/strong>: <\/p>\n<pre>\r\n# sudo \/etc\/init.d\/apache2 reload\r\n<\/pre>\n<p>So, now the following sites are working:<br \/>\n<a href=\"club.ladby.ru\" title=\"club.ladby.ru\">club.ladby.ru<\/a><br \/>\n<a href=\"ladby.ru\" title=\"ladby.ru\">ladby.ru<\/a><br \/>\n<a href=\"www.ladby.ru\" title=\"www.ladby.ru\">www.ladby.ru<\/a><br \/>\n<a href=\"lovecakes.ru\" title=\"lovecakes.ru\">lovecakes.ru<\/a><br \/>\n<a href=\"www.lovecakes.ru\" title=\"www.lovecakes.ru\">www.lovecakes.ru<\/a><br \/>\n<a href=\"galina.lovecakes.ru\" title=\"galina.lovecakes.ru\">galina.lovecakes.ru<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wanted to be able to open sites like *.ladby.ru and *.lovecakes.ru besides main sites ladby.ru and lovecakes.ru. This is how I solved this problem &#8211; by editing Apache config file, making it much simpler and by using ServerNames instead of ServerAliases. ServerName www.lovecakes.ru DocumentRoot \/var\/www\/lovecakes.ru\/public\/ ServerName galina.lovecakes.ru DocumentRoot \/var\/www\/galina.lovecakes.ru\/public\/ ServerName www.ladby.ru DocumentRoot \/var\/www\/ladby.ru\/public\/ ServerName [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[74],"tags":[],"class_list":["post-2217","post","type-post","status-publish","format-standard","hentry","category-web-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Apache config file with multiple VirtualHosts - Denis Kutlubaev<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.alwawee.ru\/?p=2217\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Apache config file with multiple VirtualHosts - Denis Kutlubaev\" \/>\n<meta property=\"og:description\" content=\"I wanted to be able to open sites like *.ladby.ru and *.lovecakes.ru besides main sites ladby.ru and lovecakes.ru. This is how I solved this problem &#8211; by editing Apache config file, making it much simpler and by using ServerNames instead of ServerAliases. ServerName www.lovecakes.ru DocumentRoot \/var\/www\/lovecakes.ru\/public\/ ServerName galina.lovecakes.ru DocumentRoot \/var\/www\/galina.lovecakes.ru\/public\/ ServerName www.ladby.ru DocumentRoot \/var\/www\/ladby.ru\/public\/ ServerName [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.alwawee.ru\/?p=2217\" \/>\n<meta property=\"og:site_name\" content=\"Denis Kutlubaev\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/alwaweemobile\" \/>\n<meta property=\"article:published_time\" content=\"2014-08-13T12:59:48+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/blog.alwawee.com\/?attachment_id=1982\" \/>\n<meta name=\"author\" content=\"Denis Kutlubaev\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Denis Kutlubaev\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2217#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2217\"},\"author\":{\"name\":\"Denis Kutlubaev\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#\\\/schema\\\/person\\\/58f1f1f57155b48afab83ba53b3e26a7\"},\"headline\":\"Apache config file with multiple VirtualHosts\",\"datePublished\":\"2014-08-13T12:59:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2217\"},\"wordCount\":99,\"commentCount\":1,\"articleSection\":[\"Web Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2217#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2217\",\"url\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2217\",\"name\":\"Apache config file with multiple VirtualHosts - Denis Kutlubaev\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#website\"},\"datePublished\":\"2014-08-13T12:59:48+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#\\\/schema\\\/person\\\/58f1f1f57155b48afab83ba53b3e26a7\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2217#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2217\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2217#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blog.alwawee.ru\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Apache config file with multiple VirtualHosts\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#website\",\"url\":\"https:\\\/\\\/blog.alwawee.ru\\\/\",\"name\":\"Denis Kutlubaev\",\"description\":\"iOS Development\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blog.alwawee.ru\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#\\\/schema\\\/person\\\/58f1f1f57155b48afab83ba53b3e26a7\",\"name\":\"Denis Kutlubaev\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg\",\"caption\":\"Denis Kutlubaev\"},\"description\":\"iOS Developer, creator of Tornado Browser and many other popular apps\",\"sameAs\":[\"http:\\\/\\\/dennis.alwawee.com\"],\"url\":\"https:\\\/\\\/blog.alwawee.ru\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Apache config file with multiple VirtualHosts - Denis Kutlubaev","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:\/\/blog.alwawee.ru\/?p=2217","og_locale":"en_US","og_type":"article","og_title":"Apache config file with multiple VirtualHosts - Denis Kutlubaev","og_description":"I wanted to be able to open sites like *.ladby.ru and *.lovecakes.ru besides main sites ladby.ru and lovecakes.ru. This is how I solved this problem &#8211; by editing Apache config file, making it much simpler and by using ServerNames instead of ServerAliases. ServerName www.lovecakes.ru DocumentRoot \/var\/www\/lovecakes.ru\/public\/ ServerName galina.lovecakes.ru DocumentRoot \/var\/www\/galina.lovecakes.ru\/public\/ ServerName www.ladby.ru DocumentRoot \/var\/www\/ladby.ru\/public\/ ServerName [&hellip;]","og_url":"https:\/\/blog.alwawee.ru\/?p=2217","og_site_name":"Denis Kutlubaev","article_publisher":"https:\/\/www.facebook.com\/alwaweemobile","article_published_time":"2014-08-13T12:59:48+00:00","og_image":[{"url":"http:\/\/blog.alwawee.com\/?attachment_id=1982","type":"","width":"","height":""}],"author":"Denis Kutlubaev","twitter_misc":{"Written by":"Denis Kutlubaev","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.alwawee.ru\/?p=2217#article","isPartOf":{"@id":"https:\/\/blog.alwawee.ru\/?p=2217"},"author":{"name":"Denis Kutlubaev","@id":"https:\/\/blog.alwawee.ru\/#\/schema\/person\/58f1f1f57155b48afab83ba53b3e26a7"},"headline":"Apache config file with multiple VirtualHosts","datePublished":"2014-08-13T12:59:48+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.alwawee.ru\/?p=2217"},"wordCount":99,"commentCount":1,"articleSection":["Web Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.alwawee.ru\/?p=2217#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.alwawee.ru\/?p=2217","url":"https:\/\/blog.alwawee.ru\/?p=2217","name":"Apache config file with multiple VirtualHosts - Denis Kutlubaev","isPartOf":{"@id":"https:\/\/blog.alwawee.ru\/#website"},"datePublished":"2014-08-13T12:59:48+00:00","author":{"@id":"https:\/\/blog.alwawee.ru\/#\/schema\/person\/58f1f1f57155b48afab83ba53b3e26a7"},"breadcrumb":{"@id":"https:\/\/blog.alwawee.ru\/?p=2217#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.alwawee.ru\/?p=2217"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.alwawee.ru\/?p=2217#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.alwawee.ru\/"},{"@type":"ListItem","position":2,"name":"Apache config file with multiple VirtualHosts"}]},{"@type":"WebSite","@id":"https:\/\/blog.alwawee.ru\/#website","url":"https:\/\/blog.alwawee.ru\/","name":"Denis Kutlubaev","description":"iOS Development","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.alwawee.ru\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.alwawee.ru\/#\/schema\/person\/58f1f1f57155b48afab83ba53b3e26a7","name":"Denis Kutlubaev","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg","caption":"Denis Kutlubaev"},"description":"iOS Developer, creator of Tornado Browser and many other popular apps","sameAs":["http:\/\/dennis.alwawee.com"],"url":"https:\/\/blog.alwawee.ru\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/posts\/2217","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2217"}],"version-history":[{"count":0,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/posts\/2217\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2217"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}