vagrant domain ERR_CONNECTION_REFUSED - apache

I am new here so let me know if i do something wrong :-)
I ran in a bit of trouble trying out Vagrant!
I installed a Vagrant Ubuntu:xenial64 box running apache2 and php 7.1 on it, it all runs smooth I can access it with ssh also in the browser by using the local ip (10.10.10.10) but I also connected a local domain ( test-site.dev ) here I am getting a "ERR_CONNECTION_REFUSED" error. I already try'd many fixed from many topic on the internet but none is working.
forwarded_port ( 80 > 8080 )
Added test-site.dev to /etc/host on Vagrant box
Added test-site.dev to windows host file
Looked at the firewall on the box ( disabled )
Made site in sites-available with the serverName and alias
Try'd other browsers
I am running all of this on a windows 10 machine. Does anyone has more tips for this problem?
EDIT:
Problem was resolved, the problem was the domain extension. .dev seems to be forced with a internal 307 redirect to https. This is wat broke it for me.

Related

AMPPS for Mac, local vhosts now no longer working

AMPPS 3.9 64-bit for Mac is working fine on MacOS 10.15.2.
I created some .local vhosts in /Applications/Ampps/Apache/conf/extra/httpd-vhosts.conf, and added the domains to /etc/hosts.
All was running well, I had about 5 different .local vhosts up and running fine.
On 1 .local website, after running WP Migrate DB Pro pulling a remote db down into the local site, every .local vhost has failed to load, producing ERR_CONNECTION_TIMED_OUT.
Restarting Apache has not resolved the issue.
I've double checked /etc/hosts/ & httpd-vhosts.conf and they both look fine.
I've tried Restore Config in the AMPPS control panel with no success. Rebooted with no success.
http://localhost/phpmyadmin opens fine.
Help and troubleshooting advice appreciated.
I found the local IP address had changed somehow, after running WP Migrate DB Pro.
Updating the hosts file with the new IP address has fixed the problem.

apache not serving index.html unless specified

Im new to setting up apache - the site works fine on localhost but when I access it from the LAN it does now display the index.html file - instead the browser says:
This site can’t be reached
localhost refused to connect.
Ive tried editing the apache2.conf file but nothing seems to work
I think you made another mistake. When you are on a different Computer on you network, the Apache server is not available on http://localhost/ but on the domain name or IP of the Apache Server.
The browser tries to open a connection to your client computer. But its not on localhost.

WAMP localhost redirects to my IP

I had to recently wipe my PC and I'm setting up my development environment again using WAMP.
After installing WAMP, if I visit http://localhost instead of seeing the WAMP homepage I get redirected to http://x.x.x.x, where x.x.x.x is my IP.
I had this issue on another PC and after setting the inbound rules for Apache HTTP Server in my Windows Firewall settings to allow all domains it fixed the issue. I applied this to my PC, and the issue does not seem to be present for Internet Explorer, whereas for Chrome and Firefox the localhost to my IP redirect issue persists even after clearing the cache for each browser.
My C:\Windows\System32\drivers\etc\hosts file looks like this:
127.0.0.1 localhost
::1 localhost
and my firewall rules look like this:
I am not currently using vhosts and I'm on a network at my workplace (if that has any implications?)
I also encountered the same issue when using Laragon which uses vhosts and whenever I visited a virtual host, e.g. mysite.dev it didn't work properly either.
My question on the Laragon forum: https://forum.laragon.org/topic/126/accessing-mysite-dev-redirects-to-url-which-shows-index-php-at-root-folder/3
The Problem
I'm behind a proxy which is used for browsing the web at my workplace. The proxy seemed to be messing up the dns resolution whenever I made a call to localhost (when using wamp) or one of my vhosts (when using Laragon).
This was clear as when I ran the following from the command line: ping site.dev I was getting the expected response from 127.0.0.1. However, when going to site.dev in my browser I was getting redirected to my IP, so essentially my etc/hosts file was being ignored for dns resolution.
The difference between the two being that the browser is using the proxy whereas the command line isn't!
The Solution
After trying many different solutions which seemed to work for localhost (on wamp) only, but not vhosts (on Laragon) I finally got to the solution which was actually so simple!
So, for chrome I simply went to chrome://settings/ > Network - Change proxy settings > LAN Settings > Proxy Server - Advanced
Then in the Exceptions text box I added the following:
*.dev;localhost;127.0.0.1
Here's a screenshot of my settings from Chrome/Internet Options
And that did the trick! Hope this can help someone else.

weird wampserver ip/port conflict

Ok, here is my problem:
I am runing WampServer 2.5 on my windows 7 Home Premium PC and I have a TP-Link TL-WR642G v2 router updated to the latest official firmware (download site). I have forwarded port 80 to my pc (ip 192.168.1.111, static) and disabled all the firewalls (see images). When i turn on WAMP, and enter localhost or 127.0.0.1 or 192.168.1.111 or even my wan ip (93.103.90.XXX) everything connects and I get my test html page but when I enter my wan ip on any machine that is not connected to my router the page doesn't load - i don't even get 403 forbidden (and yes my wamp says server online an i have edited the httpd.conf). Also http://www.yougetsignal.com/tools/open-ports/ and http://www.whatsmyip.org/port-scanner/ say port 80 is closed/timed out. Everything worked fine a week ago and i could access my server from anywhere with my public ip. I also tried other ports but i get the same thing, tried WAMP 2.4 with no success. All i did from last week was downgrade from Ultimate to Home Premium and install the drivers of course (but I guess that has no effect) and upgraded my router firmware (linked above). Any idea why it doesn't work? Does anyone have the older firmware, so I can try downgrading to it?
Thank you for reading, David :O
If you haven't done so already; then change the Management port of the Router to something other than port 80. That way you aren't conflicting with the WampServer. This is more than likely the issue.
You shouldn't have to change anything in the Firewall as Virtual Servers will set a rule to allow the packets.
As a test can you try to open up other ports on your computer like SSH or Telnet. If you find the that forwarding settings work to these protocols then you know the issue is not with the Router or ISP, but with a firewall setting on the Computer.
You can use this site to see if your ports are open (if you are on the LAN): http://www.canyouseeme.org/

Unable To Connect To MAMP Server From Other Devices

I have MAMP PRO running locally on my machine (Mavericks). I can connect find to localhost and apache is running on port 80.
The test website I have set up is served. I can browse to it via http:// my-local-host (have to put a dash in because stack exchange doesn't like URLs) or http://mymachinename.local or http://XXX.XXX.X.XX (my ipaddress).
It's not working remotely though from either iPhone or iPad. I have tried turning off the firewall. I have tried adding a rule to the firewall to allow incoming connections to httpd. Neither work.
I also have Little Snitch installed. I tried turning off Little snitch and also creating a rule to allow traffic through to port 80 via httpd. Neither work.
Anyone else had similar issues and found a resolution?
The problem is DNS.
MAMP writes your Hosts to /etc/hosts.
Example:
127.0.0.1 example.com
Your Iphone's host file has no such entry. This is why it does not work.
You need e.g. a "DNS-server", which you can enter in
Settings - Wlan - static as Router on your phone.
I think your problem would be addressed if you use the Dynamic DNS option in MAMP PRO. Then, using a third party company like noIP.com, you could setup myTestBox.ddns.net and pull up your website on your iPad.