1

On my Laravel Homestead configuration file (Homestead.yaml), I'm defining my domain maps as such:

sites:
    - map: ~^(?:www\.)?(?<project>.+)$
      to: /home/vagrant/www/\$project/public

Thanks to this, I can visit foo.dev or www.foo.dev, umbrella.dev or www.umbrella.dev etc., and it always matches appropriate project folder, /foo/public, /umbrella/public etc.

I find this very convenient solution, but I found one problem with it. When I inspect $_SERVER superglobal, I see that it equals to ~^(?:www\.)?(?<project>.+)$ instead of the valid domain after parsing. That's fine most of time, but some projects like Kirby CMS use this value to build URLs.

How can I make SERVER_NAME to be foo.dev, umbrella.dev etc.?

Robo Robok
  • 21,132
  • 17
  • 68
  • 126
  • I'm unfamiliar with Laravel homestead, but you can set the server name in your nginx configuration, *right*? Or should homestead allow you to not set up "virtual hosts"? – ʰᵈˑ Jan 18 '17 at 13:20
  • I'm wondering if there is maybe some way to do it via Homestead.yaml, couldn't find anything about it. – Robo Robok Jan 18 '17 at 13:24
  • Seems like no, see: http://stackoverflow.com/a/25268662/3000179 – ʰᵈˑ Jan 18 '17 at 13:27
  • I added the project I need explicitly in Homestead.yaml as temporary solution, but the question is still open. – Robo Robok Jan 18 '17 at 13:31

0 Answers0