2

I am currently developing a mobile PHP project on localhost (or, to be more precise, a locally hosted website reachable at http://azgoth/) on my desktop computer and wish to check out how the design looks on my phone's various browsers, however, since the project's actually in my computer rather than the public net, I am unable to do so.

Both my Desktop computer and smartphone connect to the internet via the same router, so I wondered, would it be possible to somehow make http://azgoth/ accessible to my smartphone in a similar way that my desktop computer accesses it, without making it public for everyone to see?

OS: Windows XP SP 3
Service: Apache HTTPD
Router: D-Link DIR-300 FTP Directory

4
  • Of course! We need more information on your current setup (e.g network and router) first.
    – iglvzx
    May 9, 2012 at 20:33
  • 100Mbit/s and D-link, if that's what you're asking. :)
    – AM-
    May 9, 2012 at 20:37
  • Oh, the router is DIR-300, my OS is Windows XP Service Pack 3, using Apache
    – AM-
    May 9, 2012 at 21:18
  • 1
    Please edit your question and add all additional details to your text!
    – slhck
    May 9, 2012 at 21:28

3 Answers 3

1

Before tweaking firewall setup / quick way:

Warning: do not make this permanent if not willing to check your router and os security as this could open services (web server and others too) to public.
Insecure but quick way to test it (may or may not work): 1. Disable your firewall. 2. Connect to your computer's IP with phone. 3. Pray for a moment.
For longer explanation and checklist enable your firewall and continue reading.

Setup up your server software (computer)

See this to find configuration files apache-virtual-hosts-xp.html, under heading "Understanding the Apache server folder structure". Your server software (apache) should listen (Apache 2.0 / Binding) on net adapter that connects to router.

It is likely that apache already listens on all adapters found and there is no need for config, in that case configuration file contains following (Listen 0.0.0.0:80 also counts here):

Listen 80

If it contains this:

Listen 127.0.0.1:80

Change this line to first one or add Listen 192.168.0.100:80 where 192.168.0.100 is your computer's IP address.

After that restart apache to reload new settings and test if you can connect to your computer's IP address (local IP) with your phone.

If connection fails, continue to routing setup:

There is possibility that you need to configure your router to allow access + configure your computer's firewall to allow incoming connections.

You should go checking your router setup, some wireless routers require that you do configuration through wire. Check your router's manual for that (or just try connecting to your router's IP).

IP address setup (router):

[Required] Make sure that your router serves IP addresses to clients (see DHCP setup from router manual) and that IP adresses used is within private address range (IPv4).

[Optional] Make your computer's (server) IP address static by assigning it to your computer network adapter MAC address. This way it is guaranteed that IP address you choose is available and assigned for your computer.

[Alternate] IP addresses can also be static but if you use static addresses you should make sure that you can set your phone's IP address by hand.

Firewall setup (router)

[Required] First, look for firewall setup and from there allow incoming (port 80) connections to your computer's ip address. Another way is to put your computers ip address to DMZ (Demilitarized Zone) which means that all filters and firewalls disabled for all ports and protocols.

[Alternate] There might also be more secure way to allow only your phone's MAC addressbetter and/or IP addressworser to connect to your computer, all of this depends on your router mfg/model.

Firewall setup (computer)

[Required] Setup your computer's firewall to allow incoming connections either to your http server software or globally to port 80. Depending on OS and firewall software there is again different ways to sort things.

Some stuff that might help:

If your D-Link router servers IP addresses DHCP it might be that http://192.168.0.1 opens up configuration utility for you. If not, but your computer still gets IP from router, then check from your computers's network configuration (IP address configuration) for gateway, this is propably your routers IP address if it is within private range ? .

2
  • thhis sounds complicated...i mean not really but...@sampo, is there like a guide or something that you recommend? i have a similar project at work doing something similar and id like to read on it.
    – somdow
    May 9, 2012 at 21:07
  • There is a lot of guides all over the google @somdow ALSO NOTE that you can just test if it works by turning your firewall off and just connecting to your computers ip but this may or may not open it to public. May 9, 2012 at 21:11
0

Another alternative is to simply make your localhost webserver visible to the public web (temporarily or permanently, depending on what you are doing).

This is probably the easiest solution, assuming you use one of the localhost tunneling services out there (there are a few), and it has the advantage that you can test performance over the mobile network and get friends/family/coworkers/... to take a look as well.

I wrote a tool to do this called PageKite (https://pagekite.net/) and there are a few others as well, for example localtunnel and showoff.

0

There is no reason to over complicate this. You could simply follow the advice on this website, but instead of connecting to a visual studio development server, simply select localhost in the address. This is what I do.

http://encosia.com/using-an-iphone-with-the-visual-studio-development-server/

It involves using fiddler 2 and couldnt be much easier. This would of course only work for development, but it is a really quick and easy method.

I know that the website is aimed at testing it on an iPhone, but it works with any phone. I use a galaxy s3 to do my testing.

Hope this helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .