skip to Main Content

It is now recommended to use Sail & Docker with Laravel 8

Now I use homestead, but I wanted to upgrade my system to the latest version 8 and I did the setup before I installed the Docker Desktop and Sail http: // localhost everything works, however nodejs npm and mysql redis are ready for everything

The topic I want to learn is sail & docker, how does multiple projects work in this structure?
For example Homestead before working on this config

- map: homestead.test
to: /home/vagrant/project1/public

- map: another.test
to: /home/vagrant/project2/public

Thanks

2

Answers


  1. You need to change the ports (MySQL, Redis, MailHog etc.) if you want to run multiple projects at the same time.

    Application, MySQL, and Redis Ports

    Add the desired ports to the .env file:

    APP_PORT=81
    FORWARD_DB_PORT=3307
    FORWARD_REDIS_PORT=6380
    

    MailHog Ports

    Update MailHog ports in the docker-compose.yml file. Change these lines:

    ports:
        - 1025:1025
        - 8025:8025
    

    to this:

    ports:
        - 1026:1025
        - 8026:8025
    

    Once the containers have been started, you can access your application at http://localhost:81 and the MailHog web interface at http://localhost:8026.

    Login or Signup to reply.
  2. Yes. You have to change to all non-conflict ports for all Laravel Sail project.

    If you want to use custom domain like what you did in Homestead,

    you can use the Nginx Proxy to achieve Multiple Project just like Homestead

    Here is my article: step-by-step tutorial you can follow with….

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search