Do I need to create a Virtual Host?











up vote
1
down vote

favorite












I am setting up a LAMP server on my VPS which runs Ubuntu 16.04



The main use of the server will be to serve as a backend for a web application.
The Apache will host the PHP files and the mySQL will host the data (testing environment).



I am following the following link to install the required https://www.linode.com/docs/websites/lamp/install-lamp-on-ubuntu-16-04
and in it there is a part where a VIRTUAL HOST is created.



My question is that, is it necessary to create a virtual host if only 1 site will run on the device?










share|improve this question






















  • Required by whom? Or, required in order to accomplish what purpose? :)
    – Wildcard
    Feb 7 '17 at 9:15










  • Required by me, as I will be hosting my php files on it that will fetch things from database and return to my app as JSON.
    – tony9099
    Feb 7 '17 at 9:17






  • 2




    My question was mildly tongue-in-cheek. Obviously if you can accomplish what you are trying to accomplish without creating a virtual host, then it wasn't required. And if you're the one requiring it or not, and you do require it (mandate it), then it is required. There may be tradeoffs involved (performance, security, convenience, scalability), but you may be the best person to answer this. Because, in short: it depends an awful lot what your goal is.
    – Wildcard
    Feb 7 '17 at 9:22















up vote
1
down vote

favorite












I am setting up a LAMP server on my VPS which runs Ubuntu 16.04



The main use of the server will be to serve as a backend for a web application.
The Apache will host the PHP files and the mySQL will host the data (testing environment).



I am following the following link to install the required https://www.linode.com/docs/websites/lamp/install-lamp-on-ubuntu-16-04
and in it there is a part where a VIRTUAL HOST is created.



My question is that, is it necessary to create a virtual host if only 1 site will run on the device?










share|improve this question






















  • Required by whom? Or, required in order to accomplish what purpose? :)
    – Wildcard
    Feb 7 '17 at 9:15










  • Required by me, as I will be hosting my php files on it that will fetch things from database and return to my app as JSON.
    – tony9099
    Feb 7 '17 at 9:17






  • 2




    My question was mildly tongue-in-cheek. Obviously if you can accomplish what you are trying to accomplish without creating a virtual host, then it wasn't required. And if you're the one requiring it or not, and you do require it (mandate it), then it is required. There may be tradeoffs involved (performance, security, convenience, scalability), but you may be the best person to answer this. Because, in short: it depends an awful lot what your goal is.
    – Wildcard
    Feb 7 '17 at 9:22













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am setting up a LAMP server on my VPS which runs Ubuntu 16.04



The main use of the server will be to serve as a backend for a web application.
The Apache will host the PHP files and the mySQL will host the data (testing environment).



I am following the following link to install the required https://www.linode.com/docs/websites/lamp/install-lamp-on-ubuntu-16-04
and in it there is a part where a VIRTUAL HOST is created.



My question is that, is it necessary to create a virtual host if only 1 site will run on the device?










share|improve this question













I am setting up a LAMP server on my VPS which runs Ubuntu 16.04



The main use of the server will be to serve as a backend for a web application.
The Apache will host the PHP files and the mySQL will host the data (testing environment).



I am following the following link to install the required https://www.linode.com/docs/websites/lamp/install-lamp-on-ubuntu-16-04
and in it there is a part where a VIRTUAL HOST is created.



My question is that, is it necessary to create a virtual host if only 1 site will run on the device?







linux ubuntu






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 7 '17 at 9:10









tony9099

1076




1076












  • Required by whom? Or, required in order to accomplish what purpose? :)
    – Wildcard
    Feb 7 '17 at 9:15










  • Required by me, as I will be hosting my php files on it that will fetch things from database and return to my app as JSON.
    – tony9099
    Feb 7 '17 at 9:17






  • 2




    My question was mildly tongue-in-cheek. Obviously if you can accomplish what you are trying to accomplish without creating a virtual host, then it wasn't required. And if you're the one requiring it or not, and you do require it (mandate it), then it is required. There may be tradeoffs involved (performance, security, convenience, scalability), but you may be the best person to answer this. Because, in short: it depends an awful lot what your goal is.
    – Wildcard
    Feb 7 '17 at 9:22


















  • Required by whom? Or, required in order to accomplish what purpose? :)
    – Wildcard
    Feb 7 '17 at 9:15










  • Required by me, as I will be hosting my php files on it that will fetch things from database and return to my app as JSON.
    – tony9099
    Feb 7 '17 at 9:17






  • 2




    My question was mildly tongue-in-cheek. Obviously if you can accomplish what you are trying to accomplish without creating a virtual host, then it wasn't required. And if you're the one requiring it or not, and you do require it (mandate it), then it is required. There may be tradeoffs involved (performance, security, convenience, scalability), but you may be the best person to answer this. Because, in short: it depends an awful lot what your goal is.
    – Wildcard
    Feb 7 '17 at 9:22
















Required by whom? Or, required in order to accomplish what purpose? :)
– Wildcard
Feb 7 '17 at 9:15




Required by whom? Or, required in order to accomplish what purpose? :)
– Wildcard
Feb 7 '17 at 9:15












Required by me, as I will be hosting my php files on it that will fetch things from database and return to my app as JSON.
– tony9099
Feb 7 '17 at 9:17




Required by me, as I will be hosting my php files on it that will fetch things from database and return to my app as JSON.
– tony9099
Feb 7 '17 at 9:17




2




2




My question was mildly tongue-in-cheek. Obviously if you can accomplish what you are trying to accomplish without creating a virtual host, then it wasn't required. And if you're the one requiring it or not, and you do require it (mandate it), then it is required. There may be tradeoffs involved (performance, security, convenience, scalability), but you may be the best person to answer this. Because, in short: it depends an awful lot what your goal is.
– Wildcard
Feb 7 '17 at 9:22




My question was mildly tongue-in-cheek. Obviously if you can accomplish what you are trying to accomplish without creating a virtual host, then it wasn't required. And if you're the one requiring it or not, and you do require it (mandate it), then it is required. There may be tradeoffs involved (performance, security, convenience, scalability), but you may be the best person to answer this. Because, in short: it depends an awful lot what your goal is.
– Wildcard
Feb 7 '17 at 9:22










2 Answers
2






active

oldest

votes

















up vote
1
down vote













If you are sure you only ever want one site running on your Ubuntu server, then the answer is no, it is not necessary to setup vhost configuration and the Linode documentation should put a footnote in there saying something to that effect.






share|improve this answer




























    up vote
    0
    down vote













    I usually create two vhosts in such situations, namely one that serves as the default vhost which just serves an empty page (or something like "it works"); and another name-based vhost that actually serves the application.



    This prevents drive-by scanning from hitting your application; as these usually just target the IP address without actually giving the correct hostname in the Host: header then these requests will be passed to the default vhost which only has a static index.html file. Hence these requests won't cause any load on your webserver / database. It also prevents your access log being dirtied by such scans.



    So, no, it's not required, but it has its advantages.






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      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',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      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%2funix.stackexchange.com%2fquestions%2f343106%2fdo-i-need-to-create-a-virtual-host%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








      up vote
      1
      down vote













      If you are sure you only ever want one site running on your Ubuntu server, then the answer is no, it is not necessary to setup vhost configuration and the Linode documentation should put a footnote in there saying something to that effect.






      share|improve this answer

























        up vote
        1
        down vote













        If you are sure you only ever want one site running on your Ubuntu server, then the answer is no, it is not necessary to setup vhost configuration and the Linode documentation should put a footnote in there saying something to that effect.






        share|improve this answer























          up vote
          1
          down vote










          up vote
          1
          down vote









          If you are sure you only ever want one site running on your Ubuntu server, then the answer is no, it is not necessary to setup vhost configuration and the Linode documentation should put a footnote in there saying something to that effect.






          share|improve this answer












          If you are sure you only ever want one site running on your Ubuntu server, then the answer is no, it is not necessary to setup vhost configuration and the Linode documentation should put a footnote in there saying something to that effect.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered yesterday









          Daniel

          165212




          165212
























              up vote
              0
              down vote













              I usually create two vhosts in such situations, namely one that serves as the default vhost which just serves an empty page (or something like "it works"); and another name-based vhost that actually serves the application.



              This prevents drive-by scanning from hitting your application; as these usually just target the IP address without actually giving the correct hostname in the Host: header then these requests will be passed to the default vhost which only has a static index.html file. Hence these requests won't cause any load on your webserver / database. It also prevents your access log being dirtied by such scans.



              So, no, it's not required, but it has its advantages.






              share|improve this answer

























                up vote
                0
                down vote













                I usually create two vhosts in such situations, namely one that serves as the default vhost which just serves an empty page (or something like "it works"); and another name-based vhost that actually serves the application.



                This prevents drive-by scanning from hitting your application; as these usually just target the IP address without actually giving the correct hostname in the Host: header then these requests will be passed to the default vhost which only has a static index.html file. Hence these requests won't cause any load on your webserver / database. It also prevents your access log being dirtied by such scans.



                So, no, it's not required, but it has its advantages.






                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  I usually create two vhosts in such situations, namely one that serves as the default vhost which just serves an empty page (or something like "it works"); and another name-based vhost that actually serves the application.



                  This prevents drive-by scanning from hitting your application; as these usually just target the IP address without actually giving the correct hostname in the Host: header then these requests will be passed to the default vhost which only has a static index.html file. Hence these requests won't cause any load on your webserver / database. It also prevents your access log being dirtied by such scans.



                  So, no, it's not required, but it has its advantages.






                  share|improve this answer












                  I usually create two vhosts in such situations, namely one that serves as the default vhost which just serves an empty page (or something like "it works"); and another name-based vhost that actually serves the application.



                  This prevents drive-by scanning from hitting your application; as these usually just target the IP address without actually giving the correct hostname in the Host: header then these requests will be passed to the default vhost which only has a static index.html file. Hence these requests won't cause any load on your webserver / database. It also prevents your access log being dirtied by such scans.



                  So, no, it's not required, but it has its advantages.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 7 '17 at 10:17









                  wurtel

                  9,79011325




                  9,79011325






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • 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.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • 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%2funix.stackexchange.com%2fquestions%2f343106%2fdo-i-need-to-create-a-virtual-host%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

                      Entries order in /etc/network/interfaces

                      新発田市

                      Grub takes very long (several minutes) to open Menu (in Multi-Boot-System)