Unable To Connect To MAMP Server From Other Devices - apache

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.

Related

Apache in Ubuntu: How Access by IP to multipe sites in the same webserver?

I have a Webserver with Ubuntu 16.04 and Apache 2.4. In that, I have in /var/inetpub/ some sites' files. Example:
/var/inetpub/site1.com/...
/var/inetpub/site2.com/...
/var/inetpub/site3.com/...
/var/inetpub/site4.com/...
I can access this sites when I am in my LAN, editng my computer's hosts file, adding the server IP, like:
192.168.1.10 site1.com
192.168.1.10 site2.com
192.168.1.10 site3.com
192.168.1.10 site4.com
With this, I can open my browser and paste the site1.com or site2.com and the web is displayed. But, now I need this sames sites to be visible in my mobile. So, before getting into something like trying to modify the equivalent in the mobile phone to the hosts file (which worth mentioning that I tried a long time ago, I lost a whole day and it did not work), I wonder if there was a simpler alternative, such as being able to access the sites through IP.
Right now, if the type the ip (192.168.1.10) in my mobile phone browser, obviously connected in my LAN, it shows me the first site (site1.com). So,
Is there any configuration that allow me to do the same with the other site? I don´t know, something like:
http://192.168.1.10/site1.com
http://192.168.1.10/site2.com
http://192.168.1.10/site3.com
http://192.168.1.10/site4.com
Maybe?
Someone could tell me that it would be easier add the urls to the local DNS of my network, but at the moment it is not an option, since I do not have access to such configuration, and getting it or having someone with such access to help me, is something... Complicated and slow.
Thanks for your help.
I thank it’s more easy if you can edit your mobile's hosts.But it not easy,you need got the root access of your android mobile.And i don't know how to do this on ios.
Optionally,edit the router's dns is work too,but it not easy too...
There is a option,you are build a DNS server on your ubuntu,then change you mobile's DNS. But it's difficult.

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/

Website in lan with virtual host?

I have a specefic problem, i have more websites on my localhost server (xammp), they has a virtul host, but i want to access this websites trough lan or wlan because so i can test it on mobile devices. If i call only ip on other device then i see xammp control panel, but i don't know how can i call websites in lan like: "site1.local, site2.local, site3.local", are here static ip's needed? On the router is DHCP enabled. I read few topics and this is all clear for me, the problem is only access on this sites trough network.
Read topics:
How to set up Apache virtual host such as http://home/, http://office/, etc
Accessing localhost (xampp) from another computer over LAN network - how to?
How to set up Apache virtual host such as http://home/, http://office/, etc
Apache: see named virtual hosts from LAN
Find your IP of your server machine. If it uses windows, press start then type into the search bar cmd. Then when a command promt comes up type in ipconfig and hit enter. Look for "IPv4-address" and to the right of that is your local IP of your computer.
Then you can use a computer on your wireless LAN or a wired connection. Simply type in the IP of your computers local IP with XAMP, and you are good to go!
Hope this helped
-Kad
I do this on work for testing. We have a XAMPP localhost server. My projects are in the htdocs folder. like this: c:\xampp\htdocs\niceproject
The IP for reqesting xampp is something like this: 192.168.10.104.
Now for calling the Websites just do this: 192.168.10.104/niceproject
I hope this is what you are looking for.
To access multiple sites (virtual hosts) served from one machine (say lanwww running apache) on mobile devices the usage of ServerName (say site1, ServerAlias site1.lanwww) fails - the DHCP on the router won't map subhosts (site1.lanwww). I found that using different ports for the subsites works nicely though - remember to add appropriate Listen statements to the ports.conf. The configuration of other webservers is left as an exercise to the reader.

How do I point a domain back to my own machine? (only for my own browser)

I want to set up a machine for testing a website before launching it. Some of the tests require logic in parsing the current host.
I want to be able to test it in my browser but i can only access it through the localhost.
I want to know how to make my browser resolve my domain to 127.0.0.1:80. (Also I don't want my DNS record to point to my test machine, this should be a local test only).
Also, is there a way to make all sub-domains of my domain access 127.0.0.1:80 as well?
Extra Info --
OS: Windows 7
Browser: Chrome
Web Server: Tomcat 7
Thank You.
EDIT ---
The solution was to add a few lines to the host file:
127.0.0.1 example.com
etc.
You're looking for the hosts file. It's more than likely what points localhost to 127.0.0.1 on your computer.
You can find it at C:\Windows\System32\drivers\etc\hosts on Windows. Or /etc/hosts on most Linux systems, if you're interested.