{"action":"created","issue":{"url":"https://api.github.com/repos/scotch-io/scotch-box/issues/243","repository_url":"https://api.github.com/repos/scotch-io/scotch-box","labels_url":"https://api.github.com/repos/scotch-io/scotch-box/issues/243/labels{/name}","comments_url":"https://api.github.com/repos/scotch-io/scotch-box/issues/243/comments","events_url":"https://api.github.com/repos/scotch-io/scotch-box/issues/243/events","html_url":"https://github.com/scotch-io/scotch-box/issues/243","id":166276093,"number":243,"title":"VirtualHosts sometimes being overridden by the default web root","user":{"login":"TomWright","id":935867,"avatar_url":"https://avatars.githubusercontent.com/u/935867?v=3","gravatar_id":"","url":"https://api.github.com/users/TomWright","html_url":"https://github.com/TomWright","followers_url":"https://api.github.com/users/TomWright/followers","following_url":"https://api.github.com/users/TomWright/following{/other_user}","gists_url":"https://api.github.com/users/TomWright/gists{/gist_id}","starred_url":"https://api.github.com/users/TomWright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomWright/subscriptions","organizations_url":"https://api.github.com/users/TomWright/orgs","repos_url":"https://api.github.com/users/TomWright/repos","events_url":"https://api.github.com/users/TomWright/events{/privacy}","received_events_url":"https://api.github.com/users/TomWright/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-19T08:33:50Z","updated_at":"2016-07-19T16:17:16Z","closed_at":"2016-07-19T16:17:16Z","body":"In my project I have 2 public directories: `public_ui` and `public_api`. The related url for each is `finances.local` and `api.finances.local`.\r\n\r\nMy project structure looks like this:\r\n\r\n    - public\r\n    --- index.php -- Only here to enable me to confirm my suspicions that this was being used instead of the associated vhost\r\n    - public_api\r\n    --- index.php\r\n    - public_ui\r\n    --- index.php\r\n    - Vagrantfile\r\n\r\nThe contents of my Vagrantfile are as follows:\r\n\r\n    # -*- mode: ruby -*-\r\n    # vi: set ft=ruby :\r\n    Vagrant.configure(\"2\") do |config|\r\n\r\n        config.vm.box = \"scotch/box\"\r\n        config.vm.network \"private_network\", ip: \"192.168.33.11\"\r\n        config.vm.hostname = \"finances.local\"\r\n        config.vm.synced_folder \".\", \"/var/www\", :nfs => { :mount_options => [\"dmode=777\",\"fmode=666\"] }\r\n\r\n        config.hostmanager.enabled = true\r\n        config.hostmanager.manage_host = true\r\n        config.hostmanager.manage_guest = true\r\n        config.hostmanager.ignore_private_ip = false\r\n        config.hostmanager.include_offline = true\r\n        config.hostmanager.aliases = %w(api.finances.local)\r\n\r\n        config.vm.provision \"shell\", path: \"provision/provision.sh\"\r\n\r\n        config.vm.provision \"shell\", inline: <<-SHELL\r\n\r\n            DOMAINS=(\"finances.local\" \"api.finances.local\")\r\n            DOMAIN_DIRS=(\"public_ui\" \"public_api\")\r\n\r\n            ## Loop through all sites\r\n            for ((i=0; i < ${#DOMAINS[@]}; i++)); do\r\n\r\n                ## Current Domain\r\n                DOMAIN=${DOMAINS[$i]}\r\n                ## Current Domain vHost Dir\r\n                DOMAIN_DIR=${DOMAIN_DIRS[$i]}\r\n\r\n                echo \"Creating directory for $DOMAIN...\"\r\n                #mkdir -p /var/www/$DOMAIN/public\r\n\r\n                echo \"Creating vhost config for $DOMAIN...\"\r\n                sudo cp /etc/apache2/sites-available/scotchbox.local.conf /etc/apache2/sites-available/$DOMAIN.conf\r\n\r\n                echo \"Updating vhost config for $DOMAIN...\"\r\n                sudo sed -i s,scotchbox.local,$DOMAIN,g /etc/apache2/sites-available/$DOMAIN.conf\r\n                sudo sed -i s,/var/www/public,/var/www/$DOMAIN_DIR,g /etc/apache2/sites-available/$DOMAIN.conf\r\n\r\n                echo \"Enabling $DOMAIN. Will probably tell you to restart Apache...\"\r\n                sudo a2ensite $DOMAIN.conf\r\n\r\n            done\r\n\r\n            echo \"So let's restart apache...\"\r\n            sudo service apache2 restart\r\n\r\n        SHELL\r\n\r\n    end\r\n\r\nThe problem is that when visiting either `finances.local` or `api.finances.local`, 50% of the time I get to the correct vhost directory, but then something happens (I have no idea what.. I'm not triggering it that I am aware of) and both of `finances.local` and `api.finances.local` both start getting pointed to public instead of the related ui/api directory.\r\n\r\nThis has happened right after calling `vagrant up`, `vagrant provision`, and also a mixture of seconds or minutes after running `vagrant up` and having it work as expected."},"comment":{"url":"https://api.github.com/repos/scotch-io/scotch-box/issues/comments/233685656","html_url":"https://github.com/scotch-io/scotch-box/issues/243#issuecomment-233685656","issue_url":"https://api.github.com/repos/scotch-io/scotch-box/issues/243","id":233685656,"user":{"login":"TomWright","id":935867,"avatar_url":"https://avatars.githubusercontent.com/u/935867?v=3","gravatar_id":"","url":"https://api.github.com/users/TomWright","html_url":"https://github.com/TomWright","followers_url":"https://api.github.com/users/TomWright/followers","following_url":"https://api.github.com/users/TomWright/following{/other_user}","gists_url":"https://api.github.com/users/TomWright/gists{/gist_id}","starred_url":"https://api.github.com/users/TomWright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomWright/subscriptions","organizations_url":"https://api.github.com/users/TomWright/orgs","repos_url":"https://api.github.com/users/TomWright/repos","events_url":"https://api.github.com/users/TomWright/events{/privacy}","received_events_url":"https://api.github.com/users/TomWright/received_events","type":"User","site_admin":false},"created_at":"2016-07-19T16:17:16Z","updated_at":"2016-07-19T16:17:16Z","body":"Hi Jeremie,\r\n\r\nThanks for the help!\r\n\r\nIt looks like I had a similar issue, except it wasn't quite as easily solved. I had to manually remove the machines from VirtualBox as they were \"inaccessible\". I probably messed things up a while ago - it's been a while since I've used it.\r\n\r\nAnyway... all seems well now so I am going to close this issue."}}
{"actor":{"display_login":"TomWright"}}