5

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?

2
  • You can definitely only run one server on a single port. I would look at running your site through something like Apache, XAMPP is pretty easy to set up and allows for running multiple Laravel sites on localhost Commented May 24, 2019 at 0:38
  • Also you could try accessing a different port on localhost, so try localhost/yourLaravelSite:8001 up to 8009 to see if it's running there Commented May 24, 2019 at 0:39

4 Answers 4

9

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

or

you can create a variable SERVER_PORT in your .env file

Example:

SERVER_PORT=80
Sign up to request clarification or add additional context in comments.

Comments

5

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

1 Comment

I use this , but in apache laravel projects it works only on port 80. I cannot run multiple laravel projects on different proejcts.
2

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

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.