Laravel homestead multiple sites choose which one is locally accesable












2















I have multiple sites in laravel homestead. Now, I want to access a spezific site via the ip in my local network. But I get allways the site I dont want...



homestead.yaml



sites:
- map: mdb.local
to: /home/vagrant/code/mdb/public
type: "apache"

- map: zz.tested
to: /home/vagrant/code/abc/public
type: "apache"

- map: 192.168.10.10
to: /home/vagrant/code/mdb/public


And my hosts



192.168.10.10 mdb.local
192.168.10.10 zz.tested


I can access both on my computer with the domain, however I allways get abc over the ip in the local network. What do I have to change to get mdb on mobile and abc is accessable only on my computer?



I've read this StackOverflow Question but - you can see my implementation of this solution - it doesn't help to solve this problem.










share|improve this question



























    2















    I have multiple sites in laravel homestead. Now, I want to access a spezific site via the ip in my local network. But I get allways the site I dont want...



    homestead.yaml



    sites:
    - map: mdb.local
    to: /home/vagrant/code/mdb/public
    type: "apache"

    - map: zz.tested
    to: /home/vagrant/code/abc/public
    type: "apache"

    - map: 192.168.10.10
    to: /home/vagrant/code/mdb/public


    And my hosts



    192.168.10.10 mdb.local
    192.168.10.10 zz.tested


    I can access both on my computer with the domain, however I allways get abc over the ip in the local network. What do I have to change to get mdb on mobile and abc is accessable only on my computer?



    I've read this StackOverflow Question but - you can see my implementation of this solution - it doesn't help to solve this problem.










    share|improve this question

























      2












      2








      2








      I have multiple sites in laravel homestead. Now, I want to access a spezific site via the ip in my local network. But I get allways the site I dont want...



      homestead.yaml



      sites:
      - map: mdb.local
      to: /home/vagrant/code/mdb/public
      type: "apache"

      - map: zz.tested
      to: /home/vagrant/code/abc/public
      type: "apache"

      - map: 192.168.10.10
      to: /home/vagrant/code/mdb/public


      And my hosts



      192.168.10.10 mdb.local
      192.168.10.10 zz.tested


      I can access both on my computer with the domain, however I allways get abc over the ip in the local network. What do I have to change to get mdb on mobile and abc is accessable only on my computer?



      I've read this StackOverflow Question but - you can see my implementation of this solution - it doesn't help to solve this problem.










      share|improve this question














      I have multiple sites in laravel homestead. Now, I want to access a spezific site via the ip in my local network. But I get allways the site I dont want...



      homestead.yaml



      sites:
      - map: mdb.local
      to: /home/vagrant/code/mdb/public
      type: "apache"

      - map: zz.tested
      to: /home/vagrant/code/abc/public
      type: "apache"

      - map: 192.168.10.10
      to: /home/vagrant/code/mdb/public


      And my hosts



      192.168.10.10 mdb.local
      192.168.10.10 zz.tested


      I can access both on my computer with the domain, however I allways get abc over the ip in the local network. What do I have to change to get mdb on mobile and abc is accessable only on my computer?



      I've read this StackOverflow Question but - you can see my implementation of this solution - it doesn't help to solve this problem.







      laravel networking local homestead






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 16 '18 at 8:43









      Patrick SchockePatrick Schocke

      981317




      981317
























          2 Answers
          2






          active

          oldest

          votes


















          2














          Apache always takes the first site alphabetically and returns that as the default host. What you can do is to make a host called 000default or similar, which will then be returned when there's no hostname.






          share|improve this answer































            0














            You can accomplish this by configuring the second app/site to run on port 81 rather than port 80, and then setting up a port forward to send 8001 or 8100 to 81.



            sites:
            - map: mdb.local
            to: /home/vagrant/code/mdb/public
            type: "apache"
            port: 81

            - map: zz.tested
            to: /home/vagrant/code/abc/public
            type: "apache"

            ports:
            - send: 8100
            to: 81


            With this, you should be able to access your mdb application via the correct port. From inside Homestead, that would be 81. From outside, that would be 8100. The port is needed regardless of whether you are using the host machine's IP address (e.g. http://192.168.1.5:8100) or a hosts entry (e.g. http://mdb.local:8100).






            share|improve this answer
























            • You can use any unused ports. It doesn't have to be 81, 8001, and/or 8100.

              – Trip
              Dec 11 '18 at 4:17











            • The one caveat: From the host machine, you would obviously need to access the mdb.local application on port 81 instead of the normal default of 80.

              – Trip
              Dec 13 '18 at 3:08












            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53334226%2flaravel-homestead-multiple-sites-choose-which-one-is-locally-accesable%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            Apache always takes the first site alphabetically and returns that as the default host. What you can do is to make a host called 000default or similar, which will then be returned when there's no hostname.






            share|improve this answer




























              2














              Apache always takes the first site alphabetically and returns that as the default host. What you can do is to make a host called 000default or similar, which will then be returned when there's no hostname.






              share|improve this answer


























                2












                2








                2







                Apache always takes the first site alphabetically and returns that as the default host. What you can do is to make a host called 000default or similar, which will then be returned when there's no hostname.






                share|improve this answer













                Apache always takes the first site alphabetically and returns that as the default host. What you can do is to make a host called 000default or similar, which will then be returned when there's no hostname.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 16 '18 at 9:20









                Simon FredstedSimon Fredsted

                508725




                508725

























                    0














                    You can accomplish this by configuring the second app/site to run on port 81 rather than port 80, and then setting up a port forward to send 8001 or 8100 to 81.



                    sites:
                    - map: mdb.local
                    to: /home/vagrant/code/mdb/public
                    type: "apache"
                    port: 81

                    - map: zz.tested
                    to: /home/vagrant/code/abc/public
                    type: "apache"

                    ports:
                    - send: 8100
                    to: 81


                    With this, you should be able to access your mdb application via the correct port. From inside Homestead, that would be 81. From outside, that would be 8100. The port is needed regardless of whether you are using the host machine's IP address (e.g. http://192.168.1.5:8100) or a hosts entry (e.g. http://mdb.local:8100).






                    share|improve this answer
























                    • You can use any unused ports. It doesn't have to be 81, 8001, and/or 8100.

                      – Trip
                      Dec 11 '18 at 4:17











                    • The one caveat: From the host machine, you would obviously need to access the mdb.local application on port 81 instead of the normal default of 80.

                      – Trip
                      Dec 13 '18 at 3:08
















                    0














                    You can accomplish this by configuring the second app/site to run on port 81 rather than port 80, and then setting up a port forward to send 8001 or 8100 to 81.



                    sites:
                    - map: mdb.local
                    to: /home/vagrant/code/mdb/public
                    type: "apache"
                    port: 81

                    - map: zz.tested
                    to: /home/vagrant/code/abc/public
                    type: "apache"

                    ports:
                    - send: 8100
                    to: 81


                    With this, you should be able to access your mdb application via the correct port. From inside Homestead, that would be 81. From outside, that would be 8100. The port is needed regardless of whether you are using the host machine's IP address (e.g. http://192.168.1.5:8100) or a hosts entry (e.g. http://mdb.local:8100).






                    share|improve this answer
























                    • You can use any unused ports. It doesn't have to be 81, 8001, and/or 8100.

                      – Trip
                      Dec 11 '18 at 4:17











                    • The one caveat: From the host machine, you would obviously need to access the mdb.local application on port 81 instead of the normal default of 80.

                      – Trip
                      Dec 13 '18 at 3:08














                    0












                    0








                    0







                    You can accomplish this by configuring the second app/site to run on port 81 rather than port 80, and then setting up a port forward to send 8001 or 8100 to 81.



                    sites:
                    - map: mdb.local
                    to: /home/vagrant/code/mdb/public
                    type: "apache"
                    port: 81

                    - map: zz.tested
                    to: /home/vagrant/code/abc/public
                    type: "apache"

                    ports:
                    - send: 8100
                    to: 81


                    With this, you should be able to access your mdb application via the correct port. From inside Homestead, that would be 81. From outside, that would be 8100. The port is needed regardless of whether you are using the host machine's IP address (e.g. http://192.168.1.5:8100) or a hosts entry (e.g. http://mdb.local:8100).






                    share|improve this answer













                    You can accomplish this by configuring the second app/site to run on port 81 rather than port 80, and then setting up a port forward to send 8001 or 8100 to 81.



                    sites:
                    - map: mdb.local
                    to: /home/vagrant/code/mdb/public
                    type: "apache"
                    port: 81

                    - map: zz.tested
                    to: /home/vagrant/code/abc/public
                    type: "apache"

                    ports:
                    - send: 8100
                    to: 81


                    With this, you should be able to access your mdb application via the correct port. From inside Homestead, that would be 81. From outside, that would be 8100. The port is needed regardless of whether you are using the host machine's IP address (e.g. http://192.168.1.5:8100) or a hosts entry (e.g. http://mdb.local:8100).







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 11 '18 at 4:17









                    TripTrip

                    1,385718




                    1,385718













                    • You can use any unused ports. It doesn't have to be 81, 8001, and/or 8100.

                      – Trip
                      Dec 11 '18 at 4:17











                    • The one caveat: From the host machine, you would obviously need to access the mdb.local application on port 81 instead of the normal default of 80.

                      – Trip
                      Dec 13 '18 at 3:08



















                    • You can use any unused ports. It doesn't have to be 81, 8001, and/or 8100.

                      – Trip
                      Dec 11 '18 at 4:17











                    • The one caveat: From the host machine, you would obviously need to access the mdb.local application on port 81 instead of the normal default of 80.

                      – Trip
                      Dec 13 '18 at 3:08

















                    You can use any unused ports. It doesn't have to be 81, 8001, and/or 8100.

                    – Trip
                    Dec 11 '18 at 4:17





                    You can use any unused ports. It doesn't have to be 81, 8001, and/or 8100.

                    – Trip
                    Dec 11 '18 at 4:17













                    The one caveat: From the host machine, you would obviously need to access the mdb.local application on port 81 instead of the normal default of 80.

                    – Trip
                    Dec 13 '18 at 3:08





                    The one caveat: From the host machine, you would obviously need to access the mdb.local application on port 81 instead of the normal default of 80.

                    – Trip
                    Dec 13 '18 at 3:08


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53334226%2flaravel-homestead-multiple-sites-choose-which-one-is-locally-accesable%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Bressuire

                    Vorschmack

                    Quarantine