Localhost won't load - mysql

I had to reset my router and modem, after a 3 hour task of getting those working properly again I can connect to the internet.
I had WordPress running locally on MAMP and the IP address I'd connect to was http://192.168.1.141:8888, now I can't access this address at all locally, the page never properly loads. http://localhost:8888/MAMP/ does load, I can access phpMyAdmin, start page etc.
However localhost:8888 sort of 'half' loads? I can see the title of the site I have running locally in the browser tab and at the bottom it says 'connecting to http://192.168.1.141:8888' but it never loads properly.
Restarted MAMP, cleared browser cache, restarted computer etc, nothing fixes it.

While 192.168.1.141 is the address you used to connect to, after resetting your router and modem, depending on how your router assigns IP addresses (statically or dynamically), your IP address may have changed.
How to check your ip address on Windows:
Click start menu
type in cmd.exe
type ipconfig into the terminal
your ip address should be listed in the results
#gilsho: ifconfig is the *nix command, MAMP I think stands for Microsoft / Apache / Mysql / PHP.
Correction: #gilsho: you are right. MAMP is Mac, so you would use ifconfig.
http://en.wikipedia.org/wiki/MAMP
Once you confirm your ip address, we can continue to help you.
Edit: To make things easier for you, I would go into your router (usually 10.0.0.1 or 192.168.0.1) and set up your ip address to a static one (they usually make it easy for you; your mac address can be found in the ipconfig results, just assign the mac address to an ip address in the range it assigns you. That way, the router will always give you the same ip regardless of whether it is restarted or not.). This will not mean you can access your webpage outside of your router network though.
Edit #2:
Try using a simple index.html (maybe your apache comes with one) that you can try loading. Perhaps it is your webpage that bricks something while loading. In any case, it's best to simplify the problem. If you can load a simple html "hello world" page, then it's likely a problem with your code.
Edit #3:
Is your webpage using any additional technologies? You have PHP, Python, Ajax/jQuery, etc. etc. If one of these components or plugins is missing or not configured, you may also see problems such as loading issues, 405/500 errors, etc.

Routers typically use DHCP to hand out local IP address to host machines. I suspect that when you restarted your router your machine received a different IP address. In order to find your new IP address, run:
ifconfig
from the command line. The output should look something like this:
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether c9:a4:51:43:5b:1b
inet6 fe80::bae8:56ff:ae23:5c1a%en0 prefixlen 64 scopeid 0x4
inet6 2601:9:400:1185:bae8:56ff:fe43:5b1a prefixlen 64 autoconf
inet6 2601:9:400:1185:fdcd:395b:4671:7cbf prefixlen 64 autoconf temporary
inet 192.168.1.113 netmask 0xffffff00 broadcast 192.168.1.255
nd6 options=1<PERFORMNUD>
media: autoselect
status: active
search for the inet field, that's your current local IP address.

Ok well that took FOREVER to fix, but after I managed to reset my router and set all that up again I decided to use manual DHCP and just changed it back to my old local IP.
God, working with any equipment you get from an ISP is a nightmare.

Related

How can I share the output of an html code written in visual studio code with someone else?

I don't think that we can share the link that we get from the live server extension to someone else for viewing our web page.
kindly advise me. I am new to front-end development.
By default LiveServer will listen for network connections on 127.0.0.1 and is available only to clients running on the same computer.
You can change that in the settings (under Live Server > Settings:Host) to specify any IP address allocated to the computer you are working on. You can also use 0.0.0.0 for every IP address allocated to that computer.
Anyone who can reach the IP address you select (which is typically anyone on the same LAN as you) can then visit http://192.0.0.10:5500/ to see the site. (Replace the IP address in that example with the one assigned to your computer that you selected above).
For someone to access the server from a different network, you will need to have an IP address on the public Internet. Typically you would get this by following the above instructions and then configuring your router to forward port 5500 from its Internet facing IP address to the IP address of your computer on the LAN.
You can also look at tunnelling a connection with by creating an SSH tunnel manually or using a service like ngrok which connects a URL on the public Internet to your local server (note that this removes the requirement to change the Live Server configuration away from 127.0.0.1).

Deploy Content on Private IP Address?

I was reading about port forwarding which got me excited to try it myself.
But I'm stuck on the first step, given an html file how can I deploy it on my laptop's private ip address with custom port?
For example, imagine my laptop's ip is 10.0.0.4
Then when typing: 10.0.0.4:9011 in the browser I want to see the contents of the file.
Port forwarding would only be necessary if you want to make your laptop/server accessible outer your home network.
It is not only about port forwarding, you also need to install and run a server service like apache if you want to open that html file in a browser.
Additionally your laptop's public IP is probably not static. Almost all internet providers give you a dynamic IP for personal use. Which means that you need to use a different IP everyday to access that file.
However if you want to use that file only in your home network, then you still need a service like apache to host your file but you dont need a port forwarding + you can make your local IP static.
Here is a useful blog to host a website on your pc

dyndns equivalent for ports? (so that port changes don't require config file changes)

DynDNS et. al. are great for not having to put IP addresses in config files... I put the dyndns domain in the config and if I ever want to change the server location I just update it in one place, and the config stays the same. But what if I want to change the port number that's used? Is there an equivalent for ports - so that I can also get what port to connect to from some service just like I get the IP from DynDNS? Or what's another solution (besides not changing the ports)?
DynDNS and DNS in general has the main purpose of not having to remember a host by its IP address. The DynDNS part comes is mostly to solve the issue of people who don't have static IP addresses, and they occasionally get new IP addresses when their DHCP leases expire.
The original intention wasn't really meant to account for someone purposely changing their IP address or port numbers. Usually a service is on a well known port that doesn't change, such has 80 for http. Depending on the protocol, you could set up a well-known port, and then have it redirect to a different port. As an example, some websites will redirect port 80 to 8080, but this is protocol dependent. This also won't work for a lot of other protocols, and you're usually stuck with the port you choose.
Using DynDNS I access three different machines behind the same router by simply adding a colon and the port number just as if I were adding it to a static IP address (ie myhome-computer.dyndns.biz:1234 ). Each port points to a different internal ip in the router. This works fine with my free host account. However, I am not aware of a port identifier that could report as the DynDNS host app does.

How do I change a process's socket connection

A process is connecting to a certain ip or domain, but I do not know what it is. The process can't connect to the server. How do I find and change it?
TCPView and netstat work best for connections already established, which isn't the original poster's position.
A better tool for this task is a packet sniffer, which can observe the connection attempt. I recommend Wireshark, which is available for all major platforms.
Details:
Install, then start Wireshark
Press Ctrl-K to start capturing
Select the network interface that you expect the program to use
Type "tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn" in the Capture Filter box (no quotes)
Start the capture, go make your program try to connect, and then stop the capture.
If you do the last step fast enough on a machine without a lot of other network activity, you will have only one captured packet. Otherwise, you'll have to dig through a list to find the one you want. This packet will show the TCP port the program is trying to use.
Type netstat at the cmd prompt to see what ports are being used by active processes. Aside from that, you can't change the port being used by the proc to connect (unless you built the app obviously)
TCPView is a nice little utility that will show you all the open connections and endpoints on the local machine.
If the program is connecting using a DNS name (e.g., example.com), you can use the hosts file (c:\windows\system32\drivers\etc\hosts) to make that name map to a different IP address.
If you mean redirect the connection programmatically, that is a lot more complicated. You're not writing malware, are you?

Performance of local domain vs localhost

Is there a performance difference between TCP connections to:
localhost / 127.0.0.1
a domain which resolves to the local machine
Or more specifically, do the latter connections go through the loopback device, or over the actual network?
The reason I'm asking is I'm thinking about changing database settings in many PHP apps so they use a full domain instead of localhost. That way we could more easily move the database to a different server, if the need arises.
This is implementation and operating system dependent. On Windows, anything connecting to a local IP address, even if it is an outside-facing IP, will go over loopback. This is a documented problem for applications such as packet sniffers, because you can't sniff the loopback. (Windows doesn't treat loopback as a "device" -- it is handled at the network level.) However, in this case it would work in your favor.
Linux, in contrast, will follow whatever you have in your routing table, so packets that are destined to your local machine will go to your local machine over the network if the routing table isn't properly configured. However, in 99% of the cases the routing will be configured properly. Your packets won't go over the loopback device, but the TCP/IP stack will know that you are contacting a local IP and it will virtually go out and back in the proper ethernet device.
In a properly configured environment, the only bottleneck for using a domain name would be DNS resolution time. Contacting an outside DNS can add additional latency into your configuration. However, if you add in the domain name into your /etc/hosts file (C:\Windows\System32\drivers\etc\hosts on Windows), your system will skip the DNS resolution phase and obtain an IP directly, making this time cost moot.
That depends on how the names are resolved. The procedure is typically /etc/hosts first and then DNS if that fails. If localhost is in your /etc/hosts, putting whatever.wherever in the file as well will make it resolve with the same speed.