Thanks @tray2 for your answer but it only allows me to answer my second question...
Indeed when I configure the hosts file:
127.0.0.1 app.myapp.test
127.0.0.1/api/api.myapp.test
My web app is displayed correctly but the API address does not work and that's normal... (impossible to put "/api/" in a hosts file)
I wish that in the same Laravel project, I can have api.myapp.com and app.myapp.com in deployment and that each of its web addresses send to the right middleware.
And I first want to do it on my development workstation to remove "/api/" in Laravel... But I don't know if this is possible?
And for my 3rd question: how to deactivate either the Web middleware or the API middleware during a deployment (because I'm going to use different servers and I don't want a server to be able to run the 2 middlewares at the same time)?