gabogabans
gabogabans

Reputation: 3553

Serve multiple laravel apps on localhost with php artisan serve

I'd like to be able to serve more than one laravel app at the same time on different tabs/ports, this is so I can showcase various designs, sadly when I run php artisan serve I can get only one app running at a time on port 8000.

Even after updating to laravel 5.8, form the docs:

Artisan Serve Improvements
In previous releases of Laravel, Artisan's serve command would serve your application on port  8000. If another serve command process was already listening on this port, an attempt to serve a second application via serve would fail. Beginning in Laravel 5.8, serve will now scan for available ports up to port 8009, allowing you to serve multiple applications at once.

Is there anything I'm missing?

Upvotes: 5

Views: 6657

Answers (4)

Aneesh Ajithkumar
Aneesh Ajithkumar

Reputation: 213

Use php artisan serve --port='YOUR-PORT' command.

or

you can create a variable SERVER_PORT in your .env file

Example:

SERVER_PORT=80

Upvotes: 9

Chirag Chauhan
Chirag Chauhan

Reputation: 59

Run php artisan serve --port port_number this will run your project on your defined port.

Upvotes: 1

Kapitan Teemo
Kapitan Teemo

Reputation: 2164

you can add --port #### when you run php artisan serve like this:

php artisan serve --port 8001, this will run your project on port 8001

Upvotes: 5

Dave
Dave

Reputation: 908

You can use Laravel Valet for this, you essentially have local domains for each site, I use it daily on MacOS if you're on windows this should help:

https://github.com/cretueusebiu/valet-windows

Upvotes: 2

Related Questions