Connect to XAMPP over LAN with iPodTouch [Solved]

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Connect to XAMPP over LAN with iPodTouch [Solved]

Postby timoto » 13. September 2012 18:27

First of all, the search is not working on this site, so sorry if I'm posting what may have already been answered.
----------------------

XAMPP 1.7.4 is hosted on a Win7 Pro system

A webapp located C:\xampp\htdocs\webapp\ is a single index.html file.

I can connect to the site locally like this http://localhost/webapp/

An iPodTouch is able to connect to the host over LAN entering the following in the safari browser:

http://192.168.0.11/

which resolves to

http://192.168.0.11/xampp/

and loads the xampp landing page.

But if I attempt to contact a webapp like this:

http://192.168.0.11/webapp/

the address resolves to http://localhost/webapp/ and the browser cannot open the page because it could not connect to the server.

http://192.168.0.11:80/webapp/ also produces the above result. I don't think entering the port is necessary anyway since I can reach the xampp landing page in the first example.

All of the above were performed with the following in place:

httpd.conf includes:

Code: Select all
AllowOverride All
Order allow,deny
Allow from all


httpd-xampp.conf includes:

Code: Select all
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
#Deny from all
#Allow from 127.0.0.0/8
Allow from all
ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>


.htaccess for the webapp includes:

Code: Select all
Order deny,allow
Allow from all


Presumably there is issue with the resolution of the webapp address getting thrown in to a loop on account of localhost.

How can I force http://192.168.0.11/webapp/ to load accross the lan ?
timoto
 
Posts: 8
Joined: 13. September 2012 18:19
Operating System: Windows 7 x64 Pro SP1

Re: Connect to XAMPP webapp over LAN with iPodTouch

Postby JonB » 13. September 2012 18:57

the address resolves to http://localhost/webapp/

the problem is likely with the 'webapp'.
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Connect to XAMPP webapp over LAN with iPodTouch

Postby timoto » 13. September 2012 22:45

@JonB

Thanks for the fast response.

What else does a webapp need to have in it besides an index.html ?

The index.html looks like this:

Code: Select all
<!DOCTYPE HTML>
<html>
<head>
<meta charset=UTF-8">
<title>Untitled Document</title>
</head>
<body>
test
</body>
</html>


Actually, I just discovered that if I rename the webapp folder from "C:\xampp\htdocs\webapp\" to "C:\xampp\htdocs\www.webapp.com\" the address "http://192.168.0.11/www.webapp.com/" will now load the index.html file on the iPodTouch. This also works without the .htaccess file, so that was not needed either. I can load the site with css style from an external file and I can also click on a link from this page to load another page in a subfolder. All good.

Strange that this is not possible with the folder named "webapp" but is possible when named "www.webapp.com"

So now I'm trying to load webapp2 which is a wordpress site. "http://192.168.0.11/www.webapp2.com/" loads but displays as text only, no css style. Tapping on any links results in a localhost loop again.

Incidentally if the folder name includes the computername it will not load "C:\xampp\htdocs\www.computername.com\" = "http://192.168.0.11/www.computername.com/" (but that's probably off topic).

Also the front page will not load if wp-admin/options-reading.php has the option for "Front page displays" as "A static page" and 2 subsequent pages selected one for Front Page and one for Posts Page.

So although I can load the front page without any configuration change to the wp structure, I still have no css styling and any links from the front page try for localhost at the base of the URL.

I have no issues connecting to the sites locally, I don't know what to look for in overcoming what is probably a very basic networking, XAMPP, WP configuration mismatch.

Any thoughts ?
timoto
 
Posts: 8
Joined: 13. September 2012 18:19
Operating System: Windows 7 x64 Pro SP1

Re: Connect to XAMPP webapp over LAN with iPodTouch

Postby JonB » 13. September 2012 23:25

It is almost certainly a matter of the configuration files containing references to 'localhost'. Hard to say what or where - but driving that out of the situation should help. As every machine is its own 'localhost' (by general agreement) you wind up in a closed loop. You might consider using the 'hosts' file(s) on some fashion if everything is local. I imagine the iPodTouch has some configuration for that.

LOL - OR - you could go to the Genius Bar and have a latte and let them figure it out. JK -(actually might not be a bad idea - although you might want to stick with the Apple Support Community) (I do Mac networks) :mrgreen:
http://www.apple.com/retail/geniusbar/

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Connect to XAMPP webapp over LAN with iPodTouch

Postby timoto » 14. September 2012 00:21

Hmmm

Since the general rule of running a local wp site is to set the site address as "http://localhost/webapp" or "http://127.0.0.1/webapp" then this is probably where the issue begins.

I think I need to give the local server in XAMPP a static IP and then point wordpress to that IP.

Would you know how to do that ?
timoto
 
Posts: 8
Joined: 13. September 2012 18:19
Operating System: Windows 7 x64 Pro SP1

Re: Connect to XAMPP webapp over LAN with iPodTouch

Postby JonB » 14. September 2012 01:03

that is the issue (basically) as far as I can tell.

Make a backup copy of everything first. (the whole XAMPP folder) - and decide now to install a backup program that will autobackup daily - for Windows I use Fbackup, free and automatic.

A: In XAMPP, change your httpd.conf
Find:
Code: Select all
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80


replacing localhost with 192.168.x.yy

save httpd.conf

restart XAMPP, it should still be available on localhost. It is 'Listening' on to all IP's on port 80, unless you changed that.

Code: Select all
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 80


B: Start & Fix Wordpress:

WordPress > Dashboard > Settings > General

WordPress Address (URL) 192.168.x.yy
Site Address (URL) 192.168.x.yy

save settings. logout of WP.

test WP
http://192.168.x.yy/whatever

I may have missed something, but I don't think so. :shock:

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Connect to XAMPP webapp over LAN with iPodTouch

Postby timoto » 14. September 2012 02:01

Thanks JonB

That looks good, but the bit I don't get is:

WordPress Address (URL) 192.168.x.yy
Site Address (URL) 192.168.x.yy


souldn't that be ?:

WordPress Address (URL) 192.168.x.yy/whatever
Site Address (URL) 192.168.x.yy/whatever

:?
timoto
 
Posts: 8
Joined: 13. September 2012 18:19
Operating System: Windows 7 x64 Pro SP1

Re: Connect to XAMPP webapp over LAN with iPodTouch

Postby lima_fil » 14. September 2012 02:33

Just change siteurl and home url in WP.

Before: http://localhost/wordpress
After: /wordpress

1.log in to Wordpress as admin, go to Settings and check the WordPress adress and Blog adress Settings.
Or If u can't access wp admin trough LAN (to change those urls), go directly to phpmyadmin.
2.Select the database used by wordpress. Then open the table "options" (should be wp_options - depending on what you provided as table prefix during installation).

Look for the Row with the Option Names "siteurl" and "home" (should be id 1 and 39). Change the value of option_value from this two rows by removing the absolute URL. For example:

Before: http://localhost/wordpress
After: /wordpress ''

from http://community.apachefriends.org/f/viewtopic.php?f=17&t=31471

I just tried this solution and it works.
Backup DB before trying.
Image
lima_fil
 
Posts: 1
Joined: 24. August 2012 00:49
Location: Belgrade
Operating System: xp

Re: Connect to XAMPP webapp over LAN with iPodTouch

Postby timoto » 14. September 2012 02:58

@lima_fil

Well it's very easy to make that change in phpmyadmin.

wp_options
row 1 siteurl : /webapp2
row 39 home : /webapp2

I then tried to load the site from the iPod Touch safari browser with "http://192.168.0.11/webapp2" but still resolves to "localhost/webapp2"

I also tried this with
Code: Select all
ServerName localhost:80
and then
Code: Select all
ServerName 192.168.0.11:80
in the httpd.conf to see if that might help, but no.

Is it possible that there are yet more places in the wordpress configuration that localhost could be residing to spoil things ?
timoto
 
Posts: 8
Joined: 13. September 2012 18:19
Operating System: Windows 7 x64 Pro SP1

Re: Connect to XAMPP webapp over LAN with iPodTouch

Postby timoto » 14. September 2012 03:06

Oh..

I cleared the cache in the browser, and now the site loads.

At last !

But now I have to retrace my steps and see which changes needed to be made.
timoto
 
Posts: 8
Joined: 13. September 2012 18:19
Operating System: Windows 7 x64 Pro SP1

Re: Connect to XAMPP webapp over LAN with iPodTouch

Postby timoto » 14. September 2012 03:29

So the short story is I only need to modify xampp's default installation here:

httpd-xampp.conf

Code: Select all
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
#Deny from all
#Allow from 127.0.0.0/8
Allow from all
ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>


to allow the access from any IP

and to modify wp-admin > settings > general

WordPress Address (URL) 192.168.01.11/webapp/
Site Address (URL) 192.168.01.11/webapp/

and finally

clear the browser cache ! :!:

no modification required to httpd.conf, httpd-vhosts.conf, .htaccess or any hosts file

thank you both for helping through this
timoto
 
Posts: 8
Joined: 13. September 2012 18:19
Operating System: Windows 7 x64 Pro SP1

Re: Connect to XAMPP webapp over LAN with iPodTouch

Postby Altrea » 14. September 2012 04:55

Hi timoto,

timoto wrote:httpd-xampp.conf

Code: Select all
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
#Deny from all
#Allow from 127.0.0.0/8
Allow from all
ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>


to allow the access from any IP

Is this really needed?
You are in your private network, so why not just Allow from 127.0.0.0/8 192.168.0.0/24 instead of Allow from all?

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Connect to XAMPP webapp over LAN with iPodTouch

Postby timoto » 14. September 2012 21:47

@Altrea

You're right of course.

I was just looking for the fastest no questions method before anything else.
timoto
 
Posts: 8
Joined: 13. September 2012 18:19
Operating System: Windows 7 x64 Pro SP1


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 122 guests