Unable to load localhost on web browser in Raspberry pi - wordpress

I created a web server on my Raspberry pi using Apache2 and Wordpress. At the beggining I used a local network (IP is 192.168.1.103) and then used a Huawei dongle to connect to the internet. When the dongle is connected, web browser unable to load localhost. When dongle is used it shows that:
"The website at https://192.168.1.103/ seems to be unavailable"
How do I correct this error?

The IP address you're using to connect to the site is a local network address.
When the device is using a mobile data dongle it's no longer connected to your local network so the local IP no longer works.
You could find out your IP address when the dongle is connected however that's impractical. There's a good chance each time you reconnect the IP address will change. Your server needs to have a static IP address.

You cannot directly access a device on a Local network/LAN from the outside/WAN. Notice you are trying to connect to your localhost so you need to be directly connected to the device in question or through a medium which intenrally connects the devices together, such as a router/wifi hub.
When we break your steps down; you are trying to connect to a localhost/device on your LAN but you are connecting via dongle which is actually connecting via outside/WAN connection. This means your GET request for the localhost URL is going to the ISP/dongle providers server first then trying to get back into your LAN - this is not possible, hence the error.
Fix: Connect to device directly or via a medium such as a router (through ethernet or wi-fi).
Additionally: if you wish to type in a url instead of an IP then this will need to be resolved. This is done by manually typing in an entry in your hosts file (in the Raspberry Pi) and inputting the resoloution info i.e www.yourwebsitename.co.uk and local IP i.e. 127.0.0.1.
Your webserver (i.e. Apache) may need to be restarted for changes to take effect. If site is not loading correctly then it could be that your web browser is displaying a cached image in which case simply clear cache in your web broswer and reopen.

Related

Client cannot reach website hosted on Server when both are connected to the same hotspot

I've connected two devices to the same personal hotspot (e.g. using an iPhone's one). I did it because I want to create a local network where the two devices can communicate with each other and also both can access to the Internet.
One is the Client, the other one plays the role of the Server and hosts a website. The two devices can ping each other but when I open the browser on the Client and put the Server's IP address and the port where the website is served, for example 172.20.10.8:3000, nothing gets displayed and eventually the page shows the request has run out of time.
This issue happens also when using an Android device's hotspot. On the other hand, when I connect both to a normal Wifi network everything works just fine.
Does it mean there's some sort of limitations when using a Hotspot?
Eventually I've found out that you need to set the Hotspot connection as a Private Network in both clients. Otherwise it will be set to Public Network and the devices' IP Address would not be visible by others.

How find correct Ip for connection Client/Server Qt?

I created two Qt apps: one client and one server.
I use them to send some data for handle a remote device.
If I am in localhost I haven't issues about them, but when i search to connect them by internet i don't know how to find correct Ip server to connect Socket Client.
How i can find this ip node?
Is there a class to find It?
you cannot find it automatically, if this is what you're asking about.
In real life you would deploy your server on some publicly accessible host, give it a domain name (important part as your host can change the IP address at any time) and connect the client via the DNS domain.
However if you're just playing around and you want to show to the world that your app works, specifying the IP address of the server in your client code would be perfectly fine (assuming you're running both the server and the client in the same network).
In that case, if you're running mac/linux run the command ifconfig (or just ip depending on the distribution). On Windows you can run the command ipconfig. Both windows and linux will give you a similar output resembling this:
Pay attention to the network adapters. There can potentially be many of them. You may have some emulated adapters if you have docker or VMWare, you may have the wireless adapters if you have a WiFi card, and then the ethernet adapters if your computer can connect to the the internet with an ethernet cable. Each of these adapters specifies a different IPv4 address. You want to pick the one that is connected to the same network as your client. So for instance if both your server machine and your client running machine are connected to the same wifi, you pick the address from the Wireless LAN adapter

Create a local wireless without internet

I would like to create a local wireless without internet.
I would like to have the possibility to connect 50 clients and access to a website using a domain name.
That means, I need a DNS and DHCP.
I sreach on internet an I found a way to achieve that but not totally and i am not sure if it will work and if it is the best way to achieve that.
I can maybe have a mini PC (server) with ad hoc network and have the client to connect on the server but:
Will it be possible on a connection to assign a ip to the client and set a DNS server ip on the client as the same ip of the server.
I found mini PCs but how can I know if the PC will handle a lot of client ? Which network card to choose ?
I think also that a router and configure DHCP on it to distribute the IPs but I would like to have one box ready object as a mini PC.
I need an advice on the best way to go with what i want to achieve and materials i need to buy and good references.
For a linux domain controler you will need to install bind to host your own DNS. It's a little involved to set up, but necessary if your network doesn't have a DNS server. If you're using a windows domain controller you will need a server OS (expensive). If you only have 50 clients the DNS resources needed will be small and you could run bind from any old box, even a Raspberry Pi. You will also need a host machine for the "website" a.k.a. an intranet. This can be the same machine as your DNS server, but can be any computer on the network. When all is done you will have your router configured with the IP of your local DNS server. The DNS server will point your local domain to whatever box hosts the intranet website.

How to connect two devices through Wifi without using mDNS?

I have an embedded webserver running on a device. Now I want a smartphone app to connect to the webserver. They are on the same wifi network but they don't know each others IP addresses.
I understand that this problem is often solved by implementing the mDNS protocol on the server. But are there any alternatives? Can the server maybe ask for specific IP address or similar?
If it has to be entirely automated, such that the embedded webserver is discoverable, perhaps scan the entire netblock looking for the correct response "http://[IP_address]/yes-im-the-one" from your embedded webserver?
Although beware, some network monitors may then consider the IP of your smartphone/device that does that scan "dangerous" and cut it off from the network - this is probably only a "big enterprise" problem.
...after you "find" your server, perhaps the application should cache/remember this, so it doesn't have to scan next time.
Other things you could do: give your embedded webserver a static IP on the LAN, either by setting this on the device itself, or via a DHCP reservation from whatever is the local DHCP server on the LAN.
What allot of emended devices do is come delivered with a static LAN IP already set on it, then it's up to the sysadmin to change their computer's IP temporarily to be in the same range, then they can visit the webserver or telnet into the default IP, and change it to what they want (to match their network's IP range)

Setting up local wireless server using WAMP

My goal is to have two laptops in a network. One is acting as a server, serving webpages to the other. The catch here is that neither is connected to the outside internet.
What I have done so far is setup WAMP on the server laptop, and it successfully serves web pages on localhost. Now I want to access these pages on the other laptop.
To do this, I had the server create an ad-hoc network and connected the other laptop to it, but I'm stuck - and I'm worried I'm not on the right track. I followed this tutorial but in the end I figured out that just explained how to spoof a text URL as an IP address, and not really what I was looking for.
So I guess I have two questions:
Is my method the best way to do this (with ad-hoc networks)? Is there some way to connect a laptop to a wireless router and have the laptop act as a server to another laptop?
If my WAMP and ad-hoc network should work, how do I connect other laptops to my server through the ad-hoc network?
Thanks!
I would suggest the first option: get a wifi router. Then you can assign static IP adresses from the routers private network or use DHCP server on the router. Hopefully you will have an option to reserve IP adresses on DHCP server so you dont have to check every time what IP adress the laptop acting as a server got. You use this address to access your web server. Also, you can use this router later as a gateway to the internet if you want.
In ad hoc mode you will probably get an address from 169.254.0.0/16 link-local scope, and you can check it by running ipconfig as #Robadob already suggested.
On your hosting laptop open cmd and call ipconfig look for the internal IP address on the network interface your hosting the ad-hoc network.
Enter that IP address into the browser on your client laptops web browser instead of localhost.
If that doesn't work, try other ip addresses listed by ipconfig (incase you used the wrong) and then check the properties of your ad-hoc network, windows firewall and any other firewall software to disable anything that might be blocking it.
An ad-hoc network is suitable option for what your doing, most people would probably use a switch or router though, however that requires hardware you probably don't have.

Resources