php artisan command serves by running multiple hosts

5

I am developing two applications, one that will be my front and another the backend, it happens that when I upload the applications to development laravel only enables one application, but it responds on both hosts.

To get clearer, I'll explain below the two commands:

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

    Laravel development server started on link

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

    Laravel development server started on link

    I run the commands at the command prompt in different instances, but the application that goes up is always the one I run on the first command, as if the second command was ignored, even though the message says it is running. Accessing either of the two hosts is only shown to me the system of the first command.

    The question is, is there any command in Laravel that I can enter in the path of the application when uploading the Laravel server? Something like: php serve --path=c:\sistemas\fo1 --host=fo1.dev --port=80

        
    asked by anonymous 30.05.2016 / 05:38

    1 answer

    3

    There is a conflict on port 80 of your machine.

    You need to change the port of the second application. Only 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 this article to do this.

        
    30.05.2016 / 07:56