{"id":804,"date":"2014-10-04T07:25:46","date_gmt":"2014-10-04T05:25:46","guid":{"rendered":"http:\/\/www.robinglauser.ch\/blog\/?p=804"},"modified":"2014-10-02T23:28:30","modified_gmt":"2014-10-02T21:28:30","slug":"supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts","status":"publish","type":"post","link":"https:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/","title":{"rendered":"Supercharge your LAMP Stack Part 2: Create dynamic virtual hosts"},"content":{"rendered":"<p>Did you ever wonder if there was a other way to organise your web projects than creating subfolders in your normal htdocs folder and using the with <a href=\"http:\/\/localhost\/project1\">http:\/\/localhost\/project1<\/a>, you&#8217;ve come to the right place.<\/p>\n<p>In this post I&#8217;ll show you how you can create dynamic virtual hosts without restarting Apache or adding anything to the Apache VirtualHost configuration.<\/p>\n<p>So let&#8217;s get started:<\/p>\n<p>If you&#8217;ve followed the <a title=\"Supercharge your LAMP Stack Part 1: Install Multiple PHP Version in Ubuntu\" href=\"http:\/\/www.robinglauser.ch\/blog\/2014\/08\/29\/supercharge-your-lamp-stack-part-1-install-multiple-php-version-in-ubuntu\/\">previous tutorial<\/a>\u00a0you should already have a working lamp setup. However if you don&#8217;t it&#8217;s really easy to set it up:<\/p>\n<pre>sudo apt-get install lamp-server^<\/pre>\n<blockquote><p>When the installation is finished you should be asked for a password for the root mysql server. After you&#8217;ve specified your password you should be able to open http:\/\/localhost\/ in you browser and see the &#8220;It Works!&#8221; message. (On Ubuntu 14.04 it&#8217;s a quiet longer page with the title &#8220;Apache2 Ubuntu Default Page&#8221;)<\/p><\/blockquote>\n<p>First we have to configure Apache to use our user to run the web server, else we will run into permission problems.<\/p>\n<p>To do this open the file \/etc\/apache2\/env.conf and change the username and group to your username and primary group (This should be the same as your username).<br \/>\nAfter this it&#8217;s quite easy, as I&#8217;ve already created a script which does everything for you.<\/p>\n<p>Just download the script from <a href=\"https:\/\/gist.githubusercontent.com\/nahakiole\/8308febc985901a43740\/raw\/2986989c891f567b72b4007a759917a53b83778b\/vhost.sh\">here <\/a>and run it with root rights &#8216;sudo vhost.sh example.dev&#8217;. This will add my vhost config and add a new host named example.dev<\/p>\n<p><script src=\"https:\/\/gist.github.com\/nahakiole\/8308febc985901a43740.js\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">Did you ever wonder if there was a other way to organise your web projects than creating subfolders in your normal htdocs folder and using the with http:\/\/localhost\/project1, you&#8217;ve come to the right place. In this post I&#8217;ll show you how you can create dynamic virtual hosts without restarting Apache or adding anything to the Apache VirtualHost configuration. So let&#8217;s &#8230; <a class=\"read-more\" href=\"https:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-804","post","type-post","status-publish","format-standard","hentry","category-fresh"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Supercharge your LAMP Stack Part 2: Create dynamic virtual hosts - Robin Glauser<\/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:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Supercharge your LAMP Stack Part 2: Create dynamic virtual hosts - Robin Glauser\" \/>\n<meta property=\"og:description\" content=\"Did you ever wonder if there was a other way to organise your web projects than creating subfolders in your normal htdocs folder and using the with http:\/\/localhost\/project1, you&#8217;ve come to the right place. In this post I&#8217;ll show you how you can create dynamic virtual hosts without restarting Apache or adding anything to the Apache VirtualHost configuration. So let&#8217;s ... Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/\" \/>\n<meta property=\"og:site_name\" content=\"Robin Glauser\" \/>\n<meta property=\"article:published_time\" content=\"2014-10-04T05:25:46+00:00\" \/>\n<meta name=\"author\" content=\"Robin Glauser\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@robinglauser\" \/>\n<meta name=\"twitter:site\" content=\"@robinglauser\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Robin Glauser\" \/>\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:\\\/\\\/www.robinglauser.ch\\\/blog\\\/2014\\\/10\\\/04\\\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/2014\\\/10\\\/04\\\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\\\/\"},\"author\":{\"name\":\"Robin Glauser\",\"@id\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/#\\\/schema\\\/person\\\/e1a94504a6ff5171fa13670932514b19\"},\"headline\":\"Supercharge your LAMP Stack Part 2: Create dynamic virtual hosts\",\"datePublished\":\"2014-10-04T05:25:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/2014\\\/10\\\/04\\\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\\\/\"},\"wordCount\":260,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/#\\\/schema\\\/person\\\/e1a94504a6ff5171fa13670932514b19\"},\"articleSection\":[\"Fresh\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/2014\\\/10\\\/04\\\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/2014\\\/10\\\/04\\\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\\\/\",\"url\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/2014\\\/10\\\/04\\\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\\\/\",\"name\":\"Supercharge your LAMP Stack Part 2: Create dynamic virtual hosts - Robin Glauser\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/#website\"},\"datePublished\":\"2014-10-04T05:25:46+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/2014\\\/10\\\/04\\\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/2014\\\/10\\\/04\\\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/2014\\\/10\\\/04\\\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Supercharge your LAMP Stack Part 2: Create dynamic virtual hosts\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/\",\"name\":\"Robin Glauser\",\"description\":\"My Blog about Development, Design and my random thoughts.\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/#\\\/schema\\\/person\\\/e1a94504a6ff5171fa13670932514b19\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/#\\\/schema\\\/person\\\/e1a94504a6ff5171fa13670932514b19\",\"name\":\"Robin Glauser\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/10\\\/DSC_1244_small.jpg\",\"url\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/10\\\/DSC_1244_small.jpg\",\"contentUrl\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/10\\\/DSC_1244_small.jpg\",\"width\":800,\"height\":530,\"caption\":\"Robin Glauser\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/10\\\/DSC_1244_small.jpg\"},\"description\":\"I'm a web developer.\",\"sameAs\":[\"https:\\\/\\\/www.robinglauser.ch\",\"https:\\\/\\\/www.instagram.com\\\/robinglauser\\\/\",\"https:\\\/\\\/x.com\\\/robinglauser\"],\"url\":\"https:\\\/\\\/www.robinglauser.ch\\\/blog\\\/author\\\/robin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Supercharge your LAMP Stack Part 2: Create dynamic virtual hosts - Robin Glauser","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:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/","og_locale":"en_US","og_type":"article","og_title":"Supercharge your LAMP Stack Part 2: Create dynamic virtual hosts - Robin Glauser","og_description":"Did you ever wonder if there was a other way to organise your web projects than creating subfolders in your normal htdocs folder and using the with http:\/\/localhost\/project1, you&#8217;ve come to the right place. In this post I&#8217;ll show you how you can create dynamic virtual hosts without restarting Apache or adding anything to the Apache VirtualHost configuration. So let&#8217;s ... Read More","og_url":"https:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/","og_site_name":"Robin Glauser","article_published_time":"2014-10-04T05:25:46+00:00","author":"Robin Glauser","twitter_card":"summary_large_image","twitter_creator":"@robinglauser","twitter_site":"@robinglauser","twitter_misc":{"Written by":"Robin Glauser","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/#article","isPartOf":{"@id":"https:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/"},"author":{"name":"Robin Glauser","@id":"https:\/\/www.robinglauser.ch\/blog\/#\/schema\/person\/e1a94504a6ff5171fa13670932514b19"},"headline":"Supercharge your LAMP Stack Part 2: Create dynamic virtual hosts","datePublished":"2014-10-04T05:25:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/"},"wordCount":260,"commentCount":0,"publisher":{"@id":"https:\/\/www.robinglauser.ch\/blog\/#\/schema\/person\/e1a94504a6ff5171fa13670932514b19"},"articleSection":["Fresh"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/","url":"https:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/","name":"Supercharge your LAMP Stack Part 2: Create dynamic virtual hosts - Robin Glauser","isPartOf":{"@id":"https:\/\/www.robinglauser.ch\/blog\/#website"},"datePublished":"2014-10-04T05:25:46+00:00","breadcrumb":{"@id":"https:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.robinglauser.ch\/blog\/2014\/10\/04\/supercharge-your-lamp-stack-part-2-create-dynamic-virtual-hosts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.robinglauser.ch\/blog\/"},{"@type":"ListItem","position":2,"name":"Supercharge your LAMP Stack Part 2: Create dynamic virtual hosts"}]},{"@type":"WebSite","@id":"https:\/\/www.robinglauser.ch\/blog\/#website","url":"https:\/\/www.robinglauser.ch\/blog\/","name":"Robin Glauser","description":"My Blog about Development, Design and my random thoughts.","publisher":{"@id":"https:\/\/www.robinglauser.ch\/blog\/#\/schema\/person\/e1a94504a6ff5171fa13670932514b19"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.robinglauser.ch\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.robinglauser.ch\/blog\/#\/schema\/person\/e1a94504a6ff5171fa13670932514b19","name":"Robin Glauser","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.robinglauser.ch\/blog\/wp-content\/uploads\/2015\/10\/DSC_1244_small.jpg","url":"https:\/\/www.robinglauser.ch\/blog\/wp-content\/uploads\/2015\/10\/DSC_1244_small.jpg","contentUrl":"https:\/\/www.robinglauser.ch\/blog\/wp-content\/uploads\/2015\/10\/DSC_1244_small.jpg","width":800,"height":530,"caption":"Robin Glauser"},"logo":{"@id":"https:\/\/www.robinglauser.ch\/blog\/wp-content\/uploads\/2015\/10\/DSC_1244_small.jpg"},"description":"I'm a web developer.","sameAs":["https:\/\/www.robinglauser.ch","https:\/\/www.instagram.com\/robinglauser\/","https:\/\/x.com\/robinglauser"],"url":"https:\/\/www.robinglauser.ch\/blog\/author\/robin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/posts\/804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/comments?post=804"}],"version-history":[{"count":7,"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/posts\/804\/revisions"}],"predecessor-version":[{"id":838,"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/posts\/804\/revisions\/838"}],"wp:attachment":[{"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/media?parent=804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/categories?post=804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/tags?post=804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}