{"id":1004,"date":"2019-08-10T18:17:22","date_gmt":"2019-08-10T18:17:22","guid":{"rendered":"http:\/\/dev.local\/?page_id=1004"},"modified":"2020-03-02T00:45:45","modified_gmt":"2020-03-02T00:45:45","slug":"apache-virtual-host-file","status":"publish","type":"page","link":"https:\/\/lamp.ciscoar.com\/?page_id=1004","title":{"rendered":"Apache Virtual Host file"},"content":{"rendered":"\n\n\n<h2 class=\"wp-block-heading\">Creating a new Virtual Host file<\/h2>\n\n\n\n<p>Let&#8217;s take advantage of the GUI provided by WinSCP to easily <strong>duplicate <\/strong>one of the available Virtual Host configuration files, to speed up the process of creation, we can then open it an modify it accordingly. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file.png\"><img loading=\"lazy\" decoding=\"async\" width=\"762\" height=\"348\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file.png\" alt=\"winscp duplicate file\" class=\"wp-image-985\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file.png 762w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file-300x137.png 300w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>Here you can type the name of the Virtual Host and be sure the file ends with &#8220;.conf&#8221; because, Apache will go over these files to recognize and serve these Virtual Hosts based on the settings inside.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file-02.png\"><img loading=\"lazy\" decoding=\"async\" width=\"437\" height=\"221\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file-02.png\" alt=\"\" class=\"wp-image-990\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file-02.png 437w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file-02-300x152.png 300w\" sizes=\"auto, (max-width: 437px) 100vw, 437px\" \/><\/a><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Duplicate and Edit<\/h2>\n\n\n\n<p>Immediately after the file is created (using the duplicate option) you have to open it and modify accordingly to reflect your new Virtual Host.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file-03.png\"><img loading=\"lazy\" decoding=\"async\" width=\"752\" height=\"410\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file-03.png\" alt=\"\" class=\"wp-image-991\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file-03.png 752w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file-03-300x164.png 300w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>The following image shows how one of these files could look like, please be aware this is just an example, you can probably find more variations on the Internet.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/subdomain-virtual-host-example.png\"><img loading=\"lazy\" decoding=\"async\" width=\"771\" height=\"317\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/subdomain-virtual-host-example.png\" alt=\"\" class=\"wp-image-992\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/subdomain-virtual-host-example.png 771w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/subdomain-virtual-host-example-300x123.png 300w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/subdomain-virtual-host-example-768x316.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Find and Replace using WinSCP<\/h2>\n\n\n\n<p>Because we are using an existing Virtual Host configuration file as a sort of template, this is the perfect place to use the WinSCP option &#8220;<strong>find and replace<\/strong>&#8221; to accelerate even more the creation of our file.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file-find-and-replace-v2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file-find-and-replace-v2.png\" alt=\"\" class=\"wp-image-1478\" width=\"741\" height=\"346\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file-find-and-replace-v2.png 741w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2019\/08\/winscp-duplicate-file-find-and-replace-v2-300x140.png 300w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/a><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/duplication-confirmation.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"413\" height=\"196\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/duplication-confirmation.jpg\" alt=\"\" class=\"wp-image-1550\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/duplication-confirmation.jpg 413w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/duplication-confirmation-300x142.jpg 300w\" sizes=\"auto, (max-width: 413px) 100vw, 413px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>Another advantage of duplicating the file is that you don&#8217;t have to worry about the file ownership and permissions because both will be inherited from the original file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Download Virtual Host template<\/h2>\n\n\n\n<p>In case you need a Virtual Host template, feel free to download the following one:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"\/download\/subdomain-virtual-host-example.txt\">subdomain-virtual-host-example.txt<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Where to go next?<\/h2>\n\n\n\n<p>Now that we have the <strong>&#8220;.conf<\/strong>&#8221; file for our brand new Virtual Host we can move to the next step.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><a href=\"\/apache-virtual-host-directories\/\">Virtual Host directory<\/a><\/strong><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Creating a new Virtual Host file Let&#8217;s take advantage of the GUI provided by WinSCP to easily duplicate one of the available Virtual Host configuration files, to speed up the process of creation, we can then open it an modify it accordingly. Here you can type the name of the Virtual Host and be sure &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/lamp.ciscoar.com\/?page_id=1004\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Apache Virtual Host file&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1004","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/1004","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1004"}],"version-history":[{"count":26,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/1004\/revisions"}],"predecessor-version":[{"id":3772,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/1004\/revisions\/3772"}],"wp:attachment":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}