Why simple http-server not running in 127.0.0.0:8080 but in 127.0.0.1:8080? - node.js

I need to run a simple http-server using nodejs. I have installed in my local repo using npm. When i run the below command, i am getting th e following message
nodejs node-modules/http-server/bin/http-server -a 127.0.0.0
Starting up http-server, serving ./ on: http://127.0.0.0:8080
But, server is not running on http://127.0.0.0:8080. All i could see in the screen is, The webpage is not available
If i change the command as,
nodejs node-modules/http-server/bin/http-server -a 127.0.0.1
it starts a local server at http://127.0.0.1:8080
I do not understand what is going on. Could any body help me to understand what's happening here?
Thanks in ADVANCE!!

127.0.0.0 is not a valid address.
See this article.

First of all take a look at this question, which tells you why, while an address ending in .0 is perfectly valid, you should avoid using it (hint: legacy reasons).
Then again, node is explicitly telling you where the server is being started, you posted it in your question:
Starting up http-server, serving ./ on: ---> http://127.0.0.1:8080 <---
Even more to the point, 127.0.0.0 is not a loopback address, but a generic (potentially assignable) network address. 127.0.0.1, on the other hand, is a loopback address, which means it's assigned to your machine and it's accessible from your machine only. Take a look at this Wikipedia article.
So what can you do? Just run your application on 127.0.0.1, since you can't (and shouldn't probably) run it on 127.0.0.0.

Related

docker-searXNG: I cannot start a tor searXNG instance (Debian)

I am kinda new to docker and as for my first project I wanted to try and start a searXNG instance on tor. There have been many people who have accomplished that, yet I cannot figure out whats wrong.
I've installed tor, searxng-docker and docker-compose on my raspberry pi (it is running raspberry pi os lite), got the .onion hostname and put it in .env and then, I got the instance running. But when I checked the link, it gave me a 404.
Can anyone help? I would really appreciate that.
The output of sudo docker ps:
The .env file (I've hide my email:
Do you want your server to be only available on Tor as a hidden service?
This is not supported out of the box.
Here some information that should help:
Add http:// in front of your server name in .env: SEARXNG_HOSTNAME=http://gpfo...onion
In Caddyfile, add bind 127.0.0.1 just before line 10 (tls {$SEARXNG_TLS}).
In torrc, but sure to have HiddenServicePort 80 127.0.0.1:80 in addition to HiddenServiceDir.

ng serve | Will not cast to ther devices

I run my app to my local machine via ssl like this:
ng serve --ssl --host: 0.0.0.0
so it is up at: https://localhost:4200
I also using my ipv4 adress which is: XXX.XXX.XX.XXX to make my requests to the server via my services, so i make my api calls like this: https://XXX.XXX.XX.XXX:80/api...
In my back end, I have created an https server so my API calls are been made via https
Everything works great to my desktop
Problem is: The app wont cast to ther devices.. it wont even load and
after some time i get the msg this site cannot be reached
The built in webpack server that is used for ng serve is not meant for production or sharing to other computers, it is only supposed to work on local for development because of security reasons. You should consider hosting a compiled version with a separate web server such as nginx. If you absolutely NEED the built in webpack one to work, you can force it to bind to all of your IP addresses with this:
ng serve --host 0.0.0.0
You may need to disable the host check as well:
ng serve --host 0.0.0.0 --disable-host-check
You can access this, but you might need to turn off your Firewall, this mostly happens in windows machines.
Try turning it off and accessing the IP from other machine.

How can I run Laravel mix on custom URL?

I am creating one application that needs to be made on staging server from one point. Because creating it on local is impossible as it has some endpoints that other servers in network has to access.
I have created an application in Vue.js and Laravel. In local, I used to run npm run hot so that I don't have to re-compile when I change some code. But as I have to continue developing this application on a live server, I want to run npm run hot on a custom domain like staging.something.com instead of localhost:8080.
I don't have any issue if somehow localhost:8080 co-operates but when I run npm run hot on a live server, Here is the error I get when I try to access the web application.
GET http://localhost:8080//js/app.js net::ERR_CONNECTION_REFUSED
I think it should show IP address of my server instead of localhost. I don't know what's wrong with this but it's not working.
Laravel mix uses the webpack-dev-server package for the run hot command.
webpack-dev-server has a switch --useLocalIp which will make it use the servers local IP address.
It also has a --host switch which can be used to set the IP address manually --host 0.0.0.0

How can one access http://localhost/ using the command line

I installed apache2 on ubuntu and I want to check that it works by accessing http://localhost/. The problem is I installed ubuntu(17.04) server, so there is no web browser, only the command line.
What can I do?
curl localhost (curl localhost:8080 if it's not port 80)
or
curl 127.0.0.1
or just test with
ping localhost
or download your index.html or something
wget localhost
I recommend installing a browser for a command line like lynx ,Browsh.
Lynx is light-weight. Fast. An img element is always shown in their alt text.
Browsh is a bit slower than Lynx. An img element is always shown ing(but as low quality as your command line can display).
I use different above depending on the purpose.
If you just want to see the localhost is working well, use lynx.
If you want to check your server working well and see details, use Browsh.
I hope my answer will help you. Any questions, google or ask me.
You can also port forward it...
You can use ngrok service(just google it) and you can port forward your local host and open it on your own web browser. . . even on your phone..
./ngrok http 80
I think this should work and give you temporary address

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