Skip to content
Advertisement

How to make artisan serve work in virtual host?

I’m on Windows 8 and I’m using WAMP to run my laravel project. I have configured apache and I created a virtual host, to access my app through http://myapp.dev.

I would like to know if it’s possible to use the built-in php server (to run the laravel aplication through artisan serve) to point to my virtualhost instead of http://localhost:8000.

I tried to change the app url in app.php but it didn’t work.

Advertisement

Answer

Point myapp.dev to 127.0.0.1 in your hosts file, and do php artisan serve --host 0.0.0.0 --port 80.

In Linux/OSX, this requires sudo privilege, I’m not sure what Windows will require. You’d want to stop Apache too, as it uses port 80 and will cause a conflict if both are trying to run on that port.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement