How to open localhost:8000 using VPS Ubuntu - node.js

hello I need help how to open http://localhost:8000 from my pc. because my project polkadot substrate installed on a VPS Ubuntu, after I try to open IP:8000 it also doesn't work
Images

You have to run the substrate node using --rpc-cors all option. Please note that substrate chains don't expose websocket connections to the public internet without some hacking. I am assuming your question asks how to connect a substrate node running on a remote server to your local pc front end. If that's right let's continue:
https://wiki.polkadot.network/docs/maintain-wss
Describes the entire process. You need to install NGINX, configure /etc/nginx/nginx.conf and within the http code block insert the mentioned code, with proper variable replacements. Then generate a self-signed SSL certificate, and open port 9944 and 443 on your remote machine. Next visit the machine with https://IP:443 to whitelist that site, and finally connect to your substrate node with a local installation of polkadot-js-apps. You cannot connect it using the online polkadot.js explorer , so you must use a local connection. And that should get you up and running.

Related

NodeJS and React - LAN connection not working

Description
I have a Node server and React App running on my notebook Ubuntu 18.04.
Notebook ip is 10.0.0.101
I tried to connect my desktop to this server on the same network
Desktop ip is 10.0.0.100
Node is running on PORT=3333
React is running on PORT=3000
I can ping my notebook from my desktop but when I try to connect to node using Insomnia or to http://10.0.0.101:3000 from my desktop I cannot reach.
Errors
When try to connect to backend with Insomnia
Error: Couldn't connect to server
When try to connect to app on 10.0.0.101:3000
ERR_CONNECTION_TIMED_OUT
What I've done
I already changed the node listen and specified the port and the ip but it didn't work.
I tried to use my phone as router and connect from my phone to react on my notebook and also didn't work.
I've tried so many things since I can't remember them all.
I'm also creating a react-native app and when I try to connect to my mobile using Expo, it just works using tunnel, but cannot get data from the backend.
Please save me.
Thanks
After making many failed attempts, I realized that the problem was in my notebook.
I checked my firewall and it was disabled and still cannot get acess to my notebook on LAN. But finally I discovered what have to be done
Solution
You have to open the specific port for TCP traffic
Ubuntu:
sudo ufw allow <PORT-NUMBER>/tcp
or for Red Hat Enterprise
firewall-cmd --add-port <PORT-NUMER>/tcp
Reference: Examples of how to open firewall ports

How to host a website with database having server as my Laptop for free and which has a https link?

I want to host my website which has a node js server and uses sql from xampp. It works great on my laptop using localhost. I want to host it on internet for free from my laptop. I want a https link which can connect to my laptop.
You can easily do this by using a module of nodejs called localtunnel. Suppose you choose a subdomain popeye assuming it is not taken before and port you are using for localhost is 3000 , then use following command .
$ npm install -g localtunnel
$ lt --port 3000 --subdomain popeye
Then whenever you go to link
http://popeye.localtunnel.me it will server from your computers localhost.
Register domain name. Use a dynamic DNS provider to map your domain name to your current IP.
This can be more or less complex.
Consider some cheap VPS server. On the long run this may be easier and cheaper, than dealing with dynamic DNS.

Run nodejs app through HTTPS

I have a node app that is setup on SSH by running node osjs run --hostname=dc-619670cb94e6.vtxfactory.org --port=4100.
It starts at http://dc-619670cb94e6.vtxfactory.org:4100/ without problems, but instead I want to serve it through HTTPS https://dc-619670cb94e6.vtxfactory.org:4100/ , where I receive an error ERR_CONNECTION_CLOSED.
If I use the port I'm unable to reach it with https, but https://dc-619670cb94e6.vtxfactory.org/ is accessible.
How can I serve the port 4100 through htttps?
Thanks.
This is an implementation detail of OS.js. Their docs recommend setting up a reverse proxy for servers. Doing this will give you more control over SSL and ports, like you want
https://manual.os-js.org/installation/

How can I access my nodejs web server from my local computer using the server domain name?

I installed nodejs and created a sample app. When I run npm start I get a message saying that I can open my web browser to http://localhost:3000 to see the app in action, but this installation is on a web server - not my local computer, so, instead of localhost:3000 I want to get there using something like mydomain.com:3000
I can't find the answer, it's very likely I just don't know how to search for it... any ideas?
I'm following the tutorial here: https://facebook.github.io/react/tutorial/tutorial.html
I think I only needed to get away from this for a while. I got it working using ssh local forwarding.
I already used an ssh config file to log in to my server without having to remember the password, so I just added this line to my config file:
LocalForward localhost:3000 xxx.xxx.xxx.xxx:3000
where xxx.xxx.xxx.xxx is my server IP address.
Then, I connected to my server via ssh:
ssh -f -N mysite
Once connected, I open up the browser and go to localhost:3000 and there it is now.
I used my ssh config file, but it should also work without it.
ssh -f -N -R 3000:localhost:3000 mydomain.com
I found this command that eventually led me to solve my problem in this link: http://stuff-things.net/2016/01/20/tunneling-to-localhost/

how to run nodejs app in vps with plesk enable

Hi guys im newbie in vps... I've bought an ovh not managed vps . I like to face problems... But I don't find any documents to these one. Is simple like I said I want to run a nodejs app in centos vps environment but I have enabled plesk.. and I saw in console running the app with the trace but I try to open website with the port and doesn't find anything.
http://vps406315.ovh.net
Thx for all guys
-----------------EDIT-------------------
I'm going to explain better,sorry for previous post.
There is no error, in my console all is ok. Like I said i have an CentOS VPS. Steps that I did:
Connect with PUTTY
Go to folder where is the NodeJS project.
I set the port to 8080
Write node index.js
The app is running and writing the right trace.
I use chrome to check the ip, and show me the default plesk page.
I use wget to check it, and with only http://92.222.71.137/. I attach
an screenshot
I tried to use with the port 8080 with the chrome and wget in putty,
and the response was the same.
In the other hand if I use http://92.222.71.137:8080/login with putty
download the right login.html, and the nodejs app write a trace
indicate me that someone connect to that page. But if I access with
chrome is not working.
Now I would like no know how to make access frome Chrome.
Thx 4 all and sorry for my newbie knowledge
You should give some other details on the configuration or eventual errors you get (both on the browser and the VPS) and how you run the node app (behind a web server, for example)
If you are not running you node app behind a web server, are the node app listening on the correct interface ? 127.0.0.1 and 92.222.71.137 (your site external address) are not the same.
On your VPS you can try to call the node app from the VPS itself using wget or cURL and looking for what happen in the app trace.
Finally it was easy... only i had to open a port to use with TCP, using
iptables -I INPUT -p tcp --dport 8856 --syn -j ACCEPT –

Resources