5

EDIT: I was stuck in this situation before but then it was Apache-related But this time I'm using NodeJS, so the old answer doesn't help.


I'm running apache a NodeJS webserver (on port 80) on Windows 7. I want to access the webserver through my mobile which shares the wifi router with my pc locally.

http://localhost works from PC.

But I can't access http://192.168.1.4 from either my phone or even my computer.

ipconfig /all on my computer lists my ip address as 192.168.1.4

Wireless LAN adapter Wireless Network Connection:
    IPv4 Address. . . . . . . . . . . : 192.168.1.4(Preferred)

I can ping my phone's (internal) ip address [192.168.1.5] from PC and vice-versa, I can ping my PC [192.168.1.4] from my phone.

So why can't I access http://192.168.1.4 from my phone? (or PC)


Firewall is off.

3 Answers 3

1

https://stackoverflow.com/questions/7980995/accesing-internal-web-server-running-node-js/7983852#7983852

I had specified a hostname when listening on the server.

server.listen(80, process.env.OPENSHIFT_NODEJS_IP || process.env.IP || '127.0.0.1')

0

Needed to add

Listen 192.168.1.4:80

in Apache's httpd.conf

0

This code fixed the problem for me (adding local IP:192.168.1.7 in my case with localhost)

var app = express();
app.listen(3000,'192.168.1.7' || 'localhost',function() {
    console.log('Application worker ' + process.pid + ' started...');
  }
  );

So you can access the server from http://localhost:3000 or http://192.168.1.7:3000 (my local IP is 192.168.1.7)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .