Do I need a different server to run node.js










-1















sorry if this is a wrong question on this forum but I am simply just stuck and need some advice. I have a shared hosting service and a cloud based hosting server with node.js installed. I want to host my website as normal but I also want to add real time chat and location tracking using node.js I am confused with what I am reading in several places because node.js is itself a server but not designed to host websites? So I have to run 2 different servers? One for the website and one to run node.js? When I setup the cloud one with a node.js script running I can no longer access the webpages.



Whats the best way for me achieve this as I am just going round in circles. Also is there a way I can set up a server on my PC and run and test both of these together before hand so I see what is needed and get it working as it will stop me ordering servers I dont need.



Many thanks for any help or advice.










share|improve this question






















  • Your question is really confusing so I will advise you to spend some time and understand what Node is and then you can possibly answer your own question or edit it: nodejs.org/en/about

    – squeekyDave
    Nov 13 '18 at 14:31











  • I know what node.js is, I am simply asking for advice on how to get the 2 to run together if possible as I cant get any answers on hosting a site and having a node application running in background

    – lucy james
    Nov 13 '18 at 14:44











  • I have a shared hosting service and a cloud based hosting server with node.js installed - in this setup. you likely need to serve them from different subdomains, or have Nginx as reverse proxy to serve them from single domain. Node is application server and is inefficient for serving static files and works best with Nginx or so. Any way, it's possible to do this with Node alone. If you don't know how to do that then you need to learn Node and Express for starters.

    – estus
    Nov 13 '18 at 14:44
















-1















sorry if this is a wrong question on this forum but I am simply just stuck and need some advice. I have a shared hosting service and a cloud based hosting server with node.js installed. I want to host my website as normal but I also want to add real time chat and location tracking using node.js I am confused with what I am reading in several places because node.js is itself a server but not designed to host websites? So I have to run 2 different servers? One for the website and one to run node.js? When I setup the cloud one with a node.js script running I can no longer access the webpages.



Whats the best way for me achieve this as I am just going round in circles. Also is there a way I can set up a server on my PC and run and test both of these together before hand so I see what is needed and get it working as it will stop me ordering servers I dont need.



Many thanks for any help or advice.










share|improve this question






















  • Your question is really confusing so I will advise you to spend some time and understand what Node is and then you can possibly answer your own question or edit it: nodejs.org/en/about

    – squeekyDave
    Nov 13 '18 at 14:31











  • I know what node.js is, I am simply asking for advice on how to get the 2 to run together if possible as I cant get any answers on hosting a site and having a node application running in background

    – lucy james
    Nov 13 '18 at 14:44











  • I have a shared hosting service and a cloud based hosting server with node.js installed - in this setup. you likely need to serve them from different subdomains, or have Nginx as reverse proxy to serve them from single domain. Node is application server and is inefficient for serving static files and works best with Nginx or so. Any way, it's possible to do this with Node alone. If you don't know how to do that then you need to learn Node and Express for starters.

    – estus
    Nov 13 '18 at 14:44














-1












-1








-1








sorry if this is a wrong question on this forum but I am simply just stuck and need some advice. I have a shared hosting service and a cloud based hosting server with node.js installed. I want to host my website as normal but I also want to add real time chat and location tracking using node.js I am confused with what I am reading in several places because node.js is itself a server but not designed to host websites? So I have to run 2 different servers? One for the website and one to run node.js? When I setup the cloud one with a node.js script running I can no longer access the webpages.



Whats the best way for me achieve this as I am just going round in circles. Also is there a way I can set up a server on my PC and run and test both of these together before hand so I see what is needed and get it working as it will stop me ordering servers I dont need.



Many thanks for any help or advice.










share|improve this question














sorry if this is a wrong question on this forum but I am simply just stuck and need some advice. I have a shared hosting service and a cloud based hosting server with node.js installed. I want to host my website as normal but I also want to add real time chat and location tracking using node.js I am confused with what I am reading in several places because node.js is itself a server but not designed to host websites? So I have to run 2 different servers? One for the website and one to run node.js? When I setup the cloud one with a node.js script running I can no longer access the webpages.



Whats the best way for me achieve this as I am just going round in circles. Also is there a way I can set up a server on my PC and run and test both of these together before hand so I see what is needed and get it working as it will stop me ordering servers I dont need.



Many thanks for any help or advice.







node.js server






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 14:17









lucy jameslucy james

64




64












  • Your question is really confusing so I will advise you to spend some time and understand what Node is and then you can possibly answer your own question or edit it: nodejs.org/en/about

    – squeekyDave
    Nov 13 '18 at 14:31











  • I know what node.js is, I am simply asking for advice on how to get the 2 to run together if possible as I cant get any answers on hosting a site and having a node application running in background

    – lucy james
    Nov 13 '18 at 14:44











  • I have a shared hosting service and a cloud based hosting server with node.js installed - in this setup. you likely need to serve them from different subdomains, or have Nginx as reverse proxy to serve them from single domain. Node is application server and is inefficient for serving static files and works best with Nginx or so. Any way, it's possible to do this with Node alone. If you don't know how to do that then you need to learn Node and Express for starters.

    – estus
    Nov 13 '18 at 14:44


















  • Your question is really confusing so I will advise you to spend some time and understand what Node is and then you can possibly answer your own question or edit it: nodejs.org/en/about

    – squeekyDave
    Nov 13 '18 at 14:31











  • I know what node.js is, I am simply asking for advice on how to get the 2 to run together if possible as I cant get any answers on hosting a site and having a node application running in background

    – lucy james
    Nov 13 '18 at 14:44











  • I have a shared hosting service and a cloud based hosting server with node.js installed - in this setup. you likely need to serve them from different subdomains, or have Nginx as reverse proxy to serve them from single domain. Node is application server and is inefficient for serving static files and works best with Nginx or so. Any way, it's possible to do this with Node alone. If you don't know how to do that then you need to learn Node and Express for starters.

    – estus
    Nov 13 '18 at 14:44

















Your question is really confusing so I will advise you to spend some time and understand what Node is and then you can possibly answer your own question or edit it: nodejs.org/en/about

– squeekyDave
Nov 13 '18 at 14:31





Your question is really confusing so I will advise you to spend some time and understand what Node is and then you can possibly answer your own question or edit it: nodejs.org/en/about

– squeekyDave
Nov 13 '18 at 14:31













I know what node.js is, I am simply asking for advice on how to get the 2 to run together if possible as I cant get any answers on hosting a site and having a node application running in background

– lucy james
Nov 13 '18 at 14:44





I know what node.js is, I am simply asking for advice on how to get the 2 to run together if possible as I cant get any answers on hosting a site and having a node application running in background

– lucy james
Nov 13 '18 at 14:44













I have a shared hosting service and a cloud based hosting server with node.js installed - in this setup. you likely need to serve them from different subdomains, or have Nginx as reverse proxy to serve them from single domain. Node is application server and is inefficient for serving static files and works best with Nginx or so. Any way, it's possible to do this with Node alone. If you don't know how to do that then you need to learn Node and Express for starters.

– estus
Nov 13 '18 at 14:44






I have a shared hosting service and a cloud based hosting server with node.js installed - in this setup. you likely need to serve them from different subdomains, or have Nginx as reverse proxy to serve them from single domain. Node is application server and is inefficient for serving static files and works best with Nginx or so. Any way, it's possible to do this with Node alone. If you don't know how to do that then you need to learn Node and Express for starters.

– estus
Nov 13 '18 at 14:44













2 Answers
2






active

oldest

votes


















0














Node can serve webpages using a framework like Express, but can cause conflicts if run on the same port as another webserver program (Apache, etc). One solution could be to serve your webpages through your webserver on port 80 (or 443 for HTTPS) and run your node server on a different port in order to send information back and forth.






share|improve this answer






























    0














    There are a number of ways you can achieve this but here is one popular approach.



    You can use NGINX as your front facing web server and proxy the requests to your backend Node service.



    In NGINX, for example, you will configure your upstream service as follows:



    upstream lucyservice 
    server 127.0.0.1:8000;
    keepalive 64;



    The 8000 you see above is just an example, you may be running your Node service on a different port.



    Further in your config (in the server config section) you will proxy the requests to your service as follows:



    location / 
    proxy_pass http://lucyservice;



    You're Node service can be running in a process manager like forever / pm2 etc. You can have multiple Node services running in a cluster depending on how many processors your machine has etc.



    So to recap - your front facing web server will be handling all traffic on port 80 (HTTP) and or 443 (HTTPS) and this will proxy the requests to your Node service running on whatever port(s) you define. All of this can happen on one single server or multiple if you need / desire.






    share|improve this answer























    • Thank you, thats the sort of help I was looking for, what software would you recommend on a PC to test all of this before moving to a server? Thank you

      – lucy james
      Nov 13 '18 at 14:59












    • You can just replicate on your local machine - just set up Nginx and I would recommend forever as it is easy (npm install -g forever). Now you can run your Node process in the background and play around with Nginx until you have set up as you need.

      – cherrysoft
      Nov 13 '18 at 15:00










    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%2f53283027%2fdo-i-need-a-different-server-to-run-node-js%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









    0














    Node can serve webpages using a framework like Express, but can cause conflicts if run on the same port as another webserver program (Apache, etc). One solution could be to serve your webpages through your webserver on port 80 (or 443 for HTTPS) and run your node server on a different port in order to send information back and forth.






    share|improve this answer



























      0














      Node can serve webpages using a framework like Express, but can cause conflicts if run on the same port as another webserver program (Apache, etc). One solution could be to serve your webpages through your webserver on port 80 (or 443 for HTTPS) and run your node server on a different port in order to send information back and forth.






      share|improve this answer

























        0












        0








        0







        Node can serve webpages using a framework like Express, but can cause conflicts if run on the same port as another webserver program (Apache, etc). One solution could be to serve your webpages through your webserver on port 80 (or 443 for HTTPS) and run your node server on a different port in order to send information back and forth.






        share|improve this answer













        Node can serve webpages using a framework like Express, but can cause conflicts if run on the same port as another webserver program (Apache, etc). One solution could be to serve your webpages through your webserver on port 80 (or 443 for HTTPS) and run your node server on a different port in order to send information back and forth.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 13 '18 at 14:34









        KatamariKatamari

        347211




        347211























            0














            There are a number of ways you can achieve this but here is one popular approach.



            You can use NGINX as your front facing web server and proxy the requests to your backend Node service.



            In NGINX, for example, you will configure your upstream service as follows:



            upstream lucyservice 
            server 127.0.0.1:8000;
            keepalive 64;



            The 8000 you see above is just an example, you may be running your Node service on a different port.



            Further in your config (in the server config section) you will proxy the requests to your service as follows:



            location / 
            proxy_pass http://lucyservice;



            You're Node service can be running in a process manager like forever / pm2 etc. You can have multiple Node services running in a cluster depending on how many processors your machine has etc.



            So to recap - your front facing web server will be handling all traffic on port 80 (HTTP) and or 443 (HTTPS) and this will proxy the requests to your Node service running on whatever port(s) you define. All of this can happen on one single server or multiple if you need / desire.






            share|improve this answer























            • Thank you, thats the sort of help I was looking for, what software would you recommend on a PC to test all of this before moving to a server? Thank you

              – lucy james
              Nov 13 '18 at 14:59












            • You can just replicate on your local machine - just set up Nginx and I would recommend forever as it is easy (npm install -g forever). Now you can run your Node process in the background and play around with Nginx until you have set up as you need.

              – cherrysoft
              Nov 13 '18 at 15:00















            0














            There are a number of ways you can achieve this but here is one popular approach.



            You can use NGINX as your front facing web server and proxy the requests to your backend Node service.



            In NGINX, for example, you will configure your upstream service as follows:



            upstream lucyservice 
            server 127.0.0.1:8000;
            keepalive 64;



            The 8000 you see above is just an example, you may be running your Node service on a different port.



            Further in your config (in the server config section) you will proxy the requests to your service as follows:



            location / 
            proxy_pass http://lucyservice;



            You're Node service can be running in a process manager like forever / pm2 etc. You can have multiple Node services running in a cluster depending on how many processors your machine has etc.



            So to recap - your front facing web server will be handling all traffic on port 80 (HTTP) and or 443 (HTTPS) and this will proxy the requests to your Node service running on whatever port(s) you define. All of this can happen on one single server or multiple if you need / desire.






            share|improve this answer























            • Thank you, thats the sort of help I was looking for, what software would you recommend on a PC to test all of this before moving to a server? Thank you

              – lucy james
              Nov 13 '18 at 14:59












            • You can just replicate on your local machine - just set up Nginx and I would recommend forever as it is easy (npm install -g forever). Now you can run your Node process in the background and play around with Nginx until you have set up as you need.

              – cherrysoft
              Nov 13 '18 at 15:00













            0












            0








            0







            There are a number of ways you can achieve this but here is one popular approach.



            You can use NGINX as your front facing web server and proxy the requests to your backend Node service.



            In NGINX, for example, you will configure your upstream service as follows:



            upstream lucyservice 
            server 127.0.0.1:8000;
            keepalive 64;



            The 8000 you see above is just an example, you may be running your Node service on a different port.



            Further in your config (in the server config section) you will proxy the requests to your service as follows:



            location / 
            proxy_pass http://lucyservice;



            You're Node service can be running in a process manager like forever / pm2 etc. You can have multiple Node services running in a cluster depending on how many processors your machine has etc.



            So to recap - your front facing web server will be handling all traffic on port 80 (HTTP) and or 443 (HTTPS) and this will proxy the requests to your Node service running on whatever port(s) you define. All of this can happen on one single server or multiple if you need / desire.






            share|improve this answer













            There are a number of ways you can achieve this but here is one popular approach.



            You can use NGINX as your front facing web server and proxy the requests to your backend Node service.



            In NGINX, for example, you will configure your upstream service as follows:



            upstream lucyservice 
            server 127.0.0.1:8000;
            keepalive 64;



            The 8000 you see above is just an example, you may be running your Node service on a different port.



            Further in your config (in the server config section) you will proxy the requests to your service as follows:



            location / 
            proxy_pass http://lucyservice;



            You're Node service can be running in a process manager like forever / pm2 etc. You can have multiple Node services running in a cluster depending on how many processors your machine has etc.



            So to recap - your front facing web server will be handling all traffic on port 80 (HTTP) and or 443 (HTTPS) and this will proxy the requests to your Node service running on whatever port(s) you define. All of this can happen on one single server or multiple if you need / desire.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 13 '18 at 14:56









            cherrysoftcherrysoft

            917717




            917717












            • Thank you, thats the sort of help I was looking for, what software would you recommend on a PC to test all of this before moving to a server? Thank you

              – lucy james
              Nov 13 '18 at 14:59












            • You can just replicate on your local machine - just set up Nginx and I would recommend forever as it is easy (npm install -g forever). Now you can run your Node process in the background and play around with Nginx until you have set up as you need.

              – cherrysoft
              Nov 13 '18 at 15:00

















            • Thank you, thats the sort of help I was looking for, what software would you recommend on a PC to test all of this before moving to a server? Thank you

              – lucy james
              Nov 13 '18 at 14:59












            • You can just replicate on your local machine - just set up Nginx and I would recommend forever as it is easy (npm install -g forever). Now you can run your Node process in the background and play around with Nginx until you have set up as you need.

              – cherrysoft
              Nov 13 '18 at 15:00
















            Thank you, thats the sort of help I was looking for, what software would you recommend on a PC to test all of this before moving to a server? Thank you

            – lucy james
            Nov 13 '18 at 14:59






            Thank you, thats the sort of help I was looking for, what software would you recommend on a PC to test all of this before moving to a server? Thank you

            – lucy james
            Nov 13 '18 at 14:59














            You can just replicate on your local machine - just set up Nginx and I would recommend forever as it is easy (npm install -g forever). Now you can run your Node process in the background and play around with Nginx until you have set up as you need.

            – cherrysoft
            Nov 13 '18 at 15:00





            You can just replicate on your local machine - just set up Nginx and I would recommend forever as it is easy (npm install -g forever). Now you can run your Node process in the background and play around with Nginx until you have set up as you need.

            – cherrysoft
            Nov 13 '18 at 15:00

















            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%2f53283027%2fdo-i-need-a-different-server-to-run-node-js%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

            Use pre created SQLite database for Android project in kotlin

            Darth Vader #20

            Ondo