Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-08-27 14:24:21

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Is it possible to show someone else a page from the local webserver?

If I have XAMPP or an equivalent local webserver running on my machine and an active internet connection plus have allowed port access via the router or firewall, I can give someone else my IP (or use dyndns service) for them to access a website hosted on my machine.

I just tried it out with a laptop and successfully see the xampp start screen. I can look at sites in the local /htdocs/ folder, but how do I look up local dev sites that are in virtualhost containers and stored elsewhere on my machine?


TXP Builders – finely-crafted code, design and txp

Offline

#2 2006-08-27 19:29:39

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Is it possible to show someone else a page from the local webserver?

For yourself, add to your hosts file. For others you are stuck with dyndns.

Offline

#3 2006-08-27 20:35:59

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Is it possible to show someone else a page from the local webserver?

If you decide to get your own domain name, you can use ZoneEdit. This way you can start getting your own domain out there to the search engines and when you’re ready, you can move it up to a hosting provider.

I began with DynDNS, my sites grew in popularity and then I registered my own domains.

hcgtv.homelinux.com was hosted on my home server for a couple of years and then the bandwidth from visitors put a damper on my surfing abilities.

There are plenty of update clients to keep your IP current on the DNS services when your Cable or DSL provider changes your router’s IP.

Offline

#4 2006-08-27 22:44:00

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: Is it possible to show someone else a page from the local webserver?

Thanks for the replies. To clarify, I’m not trying to host an internet site for the world in general. I really want to test my own sites that are stored on my desktop computer from a laptop (mac testing) and maybe every now and then let someone else take a look without me having to transfer everything to my online host, or to transfer all files and databases to the laptop’s own webserver each time I want to just check if the css is (mis)behaving :-)

On my own computer I add a line to the hosts file in windows for each new test site, then set up virtualhost containers in the apache/conf/httpd.conf in xampp and have the txp installations, images etc. on another drive which is given in the httpd.conf (I prefer to keep as much data off the system drive as possible). As a result the files are not in the /htdoc directory of the webserver and I cannot therefore navigate to the sites through the subdirectories.

I wondered if there was simple way of either entering the correct url into the browser or somehow letting the laptop know where to find my local virtualhosts. Thinking aloud, can I perhaps enter the domains in the hosts file on the laptop and point it to my desktop 192.168.178.xxx IP? And if so, how/where does one enter hosts information on the mac?


TXP Builders – finely-crafted code, design and txp

Offline

#5 2006-11-29 21:04:24

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: Is it possible to show someone else a page from the local webserver?

I finally got a bit further with the local setup and thought I’d document it in case it is of help to others. I’m still a beginner in these things so the experts out there should shout if improvements are necessary.

Aim: to be able to do browser testing from the laptop without having to port across the files and databases. I just wanted to fire up the laptop and call up the sites served from the desktop machine.

Setup is as follows:
A: A desktop windows XP machine with a XAMPP setup and test sites in virtual hosts as described above.
B: A mac/win laptop with other browsers on it (e.g. Mac browsers, windows: IE7).

Both are behind a WLAN router. I have given each a fixed IP Address on the local setup:

  • Desktop (A): 192.168.178.100
  • Laptop (B): 192.168.178.22

Your IPs might be different but should follow the typical 192.168.xxx.xxx pattern. The main thing is they shouldn’t change every time you start up your computer. If you change this you may have to set these up in your broadband router too.

On the desktop XAMPP machine (A)

1. Find your httpd.conf file, in my case in the /apache/conf/ subdirectory, make a backup (!) and then open it with a text editor. Find the line beginning Listen 80 and change it as follows:

#Listen 80
Listen 127.0.0.1:80
Listen 192.168.178.100:80

These IPs are both for the XAMPP machine. The first is the computer-internal IP of the desktop machine and the second the LAN-internal IP of the desktop machine as seen by other machines in the LAN.

2. Scroll down to the end of the http.conf (older XAMPP installs) or find the \extra\httpd-vhosts.conf virtualhost config file used in more recent XAMPP versions. Immediately preceding the list of Virtualhosts add:

NameVirtualHost 127.0.0.1:80
NameVirtualHost 192.168.178.100:80

Then for each of your test sites set up a virtual host container as follows. A line similar to NameVirtualHost mytestsite.org:80 should =not= precede this information. If there is one comment it out by putting a # in front.

<VirtualHost 127.0.0.1:80 192.168.178.100:80>
   ServerAdmin admin@local.mytestsite.org
      DocumentRoot "I:/websites/mytestsite"
   ServerName local.mytestsite.org
   <Directory "I:/websites/mytestsite">
        Options Indexes FollowSymLinks 
        AllowOverride FileInfo
   </Directory>
</VirtualHost>

The exact setup of your VirtualHost container might be slightly different. See Destry’s article in the Textbook. In the above replace:

  • the second IP in the opening VirtualHost with the one that match your system
  • the ServerName, ServerAdmin with your desired local domain name, and
  • the DocumentRoot and Directory information with the location of your txp installation.

3. Save the httpd.conf and httpd-vhosts.conf files.

4. Close down and restart XAMPP.

5. Finally ensure your firewall accepts incoming traffic on Port 80 (HTTP) from your laptop IP, in my example here that is 192.168.178.22.

On the laptop (B)

1. Find the hosts file.
In Windows XP it is in (system-drive):\WINDOWS\system32\drivers\etc\ and you can open it with a normal text editor. The file has no extension. Don’t let your editor re-save it as .txt.
On the Mac you can read up on how to edit the hosts file on OS-X.

Either way add a line for each site you wish to access on your desktop machine allocating it explicitly to the desktop machine’s IP address, e.g.:

192.168.178.100 local.mytestsite.org
192.168.178.100 local.secondtestsite.org

2. Save the hosts file and restart your browser (if no luck then reboot).

3. You should be able to enter local.mytestsite.org into the address bar of the laptop browser and see the pages from your desktop machine. Of course, XAMPP has to be running on the desktop machine and your firewall allows access from the laptop (usually port 80 from 192.168.178.22, the laptop IP).


TXP Builders – finely-crafted code, design and txp

Offline

#6 2006-11-29 21:33:12

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: Is it possible to show someone else a page from the local webserver?

@Jacob, I wouldn’t use XAMPP on a Desktop mashine to allow Access from outside through DynDNS.
I also wouldn’t use Wireless Access to run Servertraffic through the Network. ( Only wired )
For outside traffic going inside ( which I am not going to do any time soon ), I’d only do it having Apache running on a dedicated separete Box, and only in the Case there is a decent Hardware Firewall right before anything else, after the plug.

regards, marios


⌃ ⇧ < ⌃ ⇧ >

Offline

#7 2006-11-30 09:41:04

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: Is it possible to show someone else a page from the local webserver?

Yes marios, this is only internal testing purposes from specified machine to specified machine within the LAN and behind the firewall. I’m not serving anything to the outside world. I have hosting for that.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB