0

i just started full stack. I have a server pysically , i want to put my code on it and run the nodejs server from it so when people want to get my site they will http://computer_name or http://computer_ip and not localhost:port (which work on my computer only..) *the server is on a private domain which cannot access the ISP(so deploying my website isnt an option)

Lux
  • 17,835
  • 5
  • 43
  • 73
Matankila
  • 101
  • 2
  • 12
  • 2
    what have you tried so far? just copy your code to your server and start it with `node myfile.js`. this will work. assuming you choose port `80` you don't have to type the port. what you want is essentially to deploy your code, but on your own server. then you probably want something like a windows service or systemd unit to keep your node server running. Depending on your os. maybe a reverse proxy in front. Try to search the web a bit for this, and then try to describe your *exact* problem so people can help. – Lux Sep 09 '18 at 01:25
  • https://stackoverflow.com/questions/17652373/how-to-change-the-url-from-localhost-to-something-else-on-a-local-system-usin – Dženis H. Sep 09 '18 at 01:39

1 Answers1

0

This is the fastest way to get you started. Locate the hosts file on your machine: C:\Windows\System32\drivers\etc

Open that file as an administrator using something like Notepad.exe ... At the very end you'll see this lines:

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
#   127.0.0.1       mySuperNodeApp.com

Here you can add your favorite domain name with the same IP address, eg mySuperNodeApp.com with the IP of 127.0.0.1.


There're other ways to achieve this, eg using Wamp Server Tools:

To change your localhost to domain name all you need to do is run your wamp server and go to localhost page.

On the localhost page, on the tool section, click on Add A Virtual Host then you will be guided to the page where you'll see 3 input fields:
a) First is the place where you enter your yourDomainName, b) The second input field is optional; you can add an IP address, or leave it empty, c) The third input field goes to the address of wamp server which is common as below: C:/wamp64/www or C:/wamp/www/

Once you are done with the above steps, click on the Start --[the creation of the virtual host].

Then go to wamp and rightclick -> tool -> restartDNS.
Now open your browser and type your domain name to open the localhost page.

Dženis H.
  • 7,284
  • 3
  • 25
  • 44