Skip to content

Quickly create a vhost

Valentin Ivaşcu edited this page May 27, 2015 · 1 revision

If you want to use serve command like in Laravel Homestead to quicly create a vhost, here is a way:

sudo nano ~/.bash_aliases

at the end of file, add:

function serve() {
        servePath=/vagrant/src/serve.sh

        if [[ "$1" && "$2" ]]
        then
                sudo dos2unix "$servePath"
                sudo bash "$servePath" "$1" "/vagrant/shared/www/$2" 80
        else
                echo "Error: missing required parameters."
                echo "Usage: "
                echo "  serve domain path"
        fi
}

then run:

source ~/.bash_aliases

Create serve.sh script

In /vagrant/ create a new directory named src then a file serve.sh with content of this file

mkdir /vagrant/src
sudo nano /vagrant/src/serve.sh

#Create a quicly vhost

mkdir /vagrant/shared/www/testDir
sudo nano /vagrant/shared/www/testDir/index.html
serve test.dev testDir
Clone this wiki locally