php Artisan command serves by running multiple hosts

Asked

Viewed 7,829 times

5

I am developing two applications, one that will be my front and the other the backend, it occurs that when I raise the applications for development the Framework only enables one applications, but responds in the two hosts.

To make it clearer, I expose below the two commands:

  1. I navigate to the fo1 system path and execute the command: php artisan serve --host=fo1.dev --port=80

Laravel Development server Started on http://fo1.dev:80

  1. I navigate to the fo2 system path and execute the command php artisan serve --host=fo2.dev --port=80

Laravel Development server Started on http://fo2.dev:80

I run the commands at the command prompt in different instances, but the application that goes up is always the one I run in the first command, as if the second command were ignored, although the message says it is running. Accessing any of the two hosts only presented me the system of the first command.

The question is this, is there a command in Laravel that I can inform the application’s path at the time of uploading the Laravel server? Something like: php serve --path=c:\sistemas\fo1 --host=fo1.dev --port=80

1 answer

4


There’s a conflict at door 80 of your machine.

You need to change the door of the second application. Only the hostname is not enough because it is only an alias for localhost:

php artisan serve --host=fo1.dev --port=8080
php artisan serve --host=fo2.dev --port=8888

To navigate you can use fo1.dev:8080 or fo2.dev:8888

Another way is to use a web server like Apache and make use of a virtualhost to use the same port in both projects. You can inspire in that article to do this.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.