Adding Additional Sites to homestead without vagrant reload --provision


Having used homestead for some time now, I have found that adding additional sites by following the guide at laravel doc quite cumbersome.

I think that it would be less cumbersome if additional site is added by adding additonal nginx configuration directly. I would recap my steps on adding local domain "melati.dev" below:


  1. Add melati.dev record to file /etc/hosts in the host machine, host OS. All the below commands were executed at virtual machine, guest OS (steps 2 up to 5)
  2. Duplicate the default site configuration homestead.app to melati.dev (it's located at /etc/nginx/sites-available)
  3. Create symbolic link from sites-vailable to sites-enabled:
    ln -sf /etc/nginx/sites-available/melati.dev /etc/nginx/sites-enabled/melati.dev
  4. Edit melati.dev file to reflect what the domain is wanted to be (items needed to be changed: server_name, root, error_log, ssl_certificate, ssl_certificate_key)
  5. Reload nginx using sudo invoke-rc.d nginx reload
That's all what I did to add additional sites in homestead. Hope it would be helpful! Thanks for reading ^_^ !

Comments

Popular Posts