How to solve google chrome "Failed to load resource: net::ERR_CONNECTION_REFUSED" issue in windows 10 when server is running on Ubuntu 18.04? - windows

I am trying to run this project on Ubuntu 18.04 server. I am running both server and client on this machine. Then from windows 10 with port 9000 I am getting access to client in my chrome browser at http://localhost:8000/#/
The browser loads the project but the problem is I can't log into the website with trusted account and some other data do not get loaded . When I see browser console I see an error message saying:
Failed to load resource: net::ERR_CONNECTION_REFUSED
This is the server setting:
This is the client setting and putty setting to connect to client.
VPN has been used to connect to server via PuTTY.
The error message in browser:
Could anyone shed some light on this issue? Is it related to windows 10 or VPN or some other issues? I followed some steps from here https://www.ionos.com/digitalguide/hosting/technical-matters/err-connection-reset/

By default, the Flask development environment uses 127.0.0.1 (localhost), which restricts access to processes on the same host (except for VMs/containers, which aren't a factor here).
To access Flask from outside of localhost (e.g., from your Windows 10 machine), use the IP address 0.0.0.0. (You can pass it to run(), or via a command line option of the flask command.
However, do note the warnings about (not) using the development environment for production use.

Related

Client application and Signoz on different Windows server

When Signoz is running locally via Docker with the client application in the same server, everything is working. However, if I configure the same application on another Windows server, I got connection timed out exception. There's no firewall issue as if I host another dummy application on port 4317, the other server can access the resource.
Please help

Localhost refused to connect on WSL2 when accessed via https://localhost:8000/ but works when using internal WSL IP adress

What I'm Trying to Achieve
To access localhost from my local machine during the development of a Symfony web app.
My Environment
WSL2 running on Windows 10
Linux, Apache2, MySQL, PHP-7.4 stack (with Xdebug3 intalled)
Debian 10
Symfony 5.4 (although not sure on if relevant to this problem)
Steps I've Taken
Set up WSL2 according to this Microsoft WSL2 tutorial
Set up LAMP stack according to this Digital Ocean tutorial
Set up Symfony according to this Symfony tutorial
Run the following bash script on startup to start my services and set the host to the virtual WSL IP in my xdebug.ini file
#!/bin/sh
REMOTEIP=`cat /etc/resolv.conf | grep nameserver | sed 's/nameserver\s//'`
sed -i -E "s/client_host=[0-9\.]+/client_host=$REMOTEIP/g" /etc/php/7.4/mods-available/xdebug.ini
service php7.4-fpm start
service apache2 start
service mysql start
Run my Symfony project on the development server using symfony serve -d (Symfony then tells me "The Web server is using PHP FPM 7.4.23 https://127.0.0.1:8000")
Go to https://localhost:8000/ in Chrome where the app is running
What I Expect to Happen
My Symfony web app to be running on https://localhost:8000/ when I visit the URL in my Chrome browser
What Actually Happens
I get "This site can't be reached localhost refused to connect." in the Chrome browser
What I've Tried
This used to happen less frequently and I would give my laptop a restart, repeat the process above, and I could connect via https://localhost:8000/. However, it refuses to connect more regularly now (like 8/10 times I start up for the day)
Connecting to https://127.0.0.1:8000 yields the same result.
Connecting to the site using the internal WSL IP address, found using hostname -I and replacing localhost with this IP (still on port 8000). This is an adequate workaround to use my app, however I am unable to interact with my database via MySQL Workbench without having to set up a new connection, therefore a fix where I can use localhost would be very helpful!
(Based off comments) Only ran symfony serve -d without starting apache and PHP services separately - still sometimes allows connections to localhost but sometimes doesn't work.
Conclusion
The behaviour is odd as it works sometimes but other times it doesn't when the exact same steps are carried out. I am unsure where else to look for answers and I can't seem to find anything online with this same problem. Please let me know if any config files, etc would be helpful. Thank you so much for your help! :)
When it's working normally, as you are clearly aware, the "localhost forwarding" feature of WSL2 means that you can access services running inside WSL2 using the "localhost" address of the Windows host.
Sometimes, however, that feature breaks down. This is known to happen when you either:
Hibernate
Have the Windows "Fast Startup" feature enabled (and it is the default). Fast Startup is a pseudo-hibernation which triggers the same problem.
Typically the best solution is to disable Hibernation and Fast Startup. However, if you do need these features, you can reset the WSL localhost feature by:
Exiting any WSL instances
Issuing wsl --shutdown
Restarting your instance
It's my experience that localhost forwarding will work after that. However, if it doesn't, thanks to #lwohlhart in the comments for mentioning that another thing to try is disabling IPv6 on WSL2, since (I believe) there's a possibility that the application is listening on IPv6 while the Windows->WSL2 connection localhost connection is being attempted on IPv6.
You can disable IPv6 on WSL2 per this Github comment by creating or editing .wslconfig in your Windows user profile directory with the following:
[wsl2]
kernelCommandLine=ipv6.disable=1
A wsl --shutdown and restart will be necessary to complete the changes.
If you find that this works, it may be possible to solve the issue by making sure to either use the IPv4 (127.0.0.1) or IPv6 (::1) address specifically in place of localhost on the Windows side, or by configuring the service to listen on both addresses.
Try to run command netstat -nltp. It shows active addresses and ports. Your nginx process should be run at 0.0.0.0:8000. 0.0.0.0 means the nginx process is available from anywhere.
If your nginx process is ran by any specific ip address, you should access it by that ip address, e.g http://192.168.4.2:8000.

How can I access a webpage located inside a VM from the host machine's browser?

I am able to access the link http://localhost/men/tops-men/jackets-men.html successfully from my VM (configured using X2Go client).
IP Address of the VM: 10.146.106.204
I am also able to ping the VM successfully from my host machine (Windows).
The page that I am trying to access is a php page deployed on Apache Web Server.
However I am not able to do so from my Windows host machine.
I tried http://10.146.106.204/men/tops-men/jackets-men.html from my Windows machine but it did not work.
Do I have to configure something on my host machine or on my VM ?
Not sure what I am missing.
On VM check you can view http://10.146.106.204/men/tops-men/jackets-men.html
If not you need to configure the web server to listen on that IP (if you're running IIS this is under "bindings" in the right-hand side panel of IIS Manager).
On Host open a cmd window and check you can ping 10.146.106.204
If not check your firewall settings on the VM.
If neither of these 2 things help then you need to add more information about your setup to the question. Those are 2 very simple things you can do to diagnose 2 basic problems you might be having.
I was finally able to solve the problem based on this SO link: Unable to access magento site from anywhere but localhost
Updated the DB table core_config_data and updated the data by replacing http://localhost with http://ip-of-vm and then restarted the apache web server.

IIS 7 Access Denied for local IP but not Localhost

I've just started to experience this error. I'm developing MVC apps and using visual studio to deploy to my inetpub/wwwroot directory.
When i publish and hit the site at http://localhost the site works as expected.
When i hit the site using my IP address http://192.168.16.216 i get the following error
Unable to display page It has not been possible to display the page
you requested for the following reason: Access Denied Contact your
system administrator if you continue to experience difficulties.
I get this error on all browsers. I'm running IIS7 on Windows 7.
Any suggestions?
As I pointed out in my comment above:
Using your network IP means you'll be going out and back in again. Is your router configured to allow access to your machine on port 80?
It's likely that your company router isn't allowing access to your machine on port 80.

Apache can't connect to http://localhost/. Port is changed to 81

I've just installed apache2.2 and installed it, but to get it running I had to change it listening port to 81. But the thing is now that I cant connect to it through localhost. The only thing I get is a login window and when I type in the authentication information that I think is my windows login. I get:
error '8002801c'
Error accessing the OLE registry.
/iisHelp/common/500-100.asp, line 17
The computer is a winxp and I've opened the ports out and no firewall is blocking apache.
Seems like the machine has another webserver running, probably IIS.
You can uninstall that through the configuration screen.
Try http://localhost:81/ to get the apache install.

Resources