External access to computer on a network

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

External access to computer on a network

Postby ade1982 » 05. February 2008 00:04

Ok, my first go at trying to set up a webserver, and I am in a world of confusion!

I have managed to successfully set up XAMPP, and it is serving files from localhost, and on our LAN (i.e. so if someone in the company types the internal address 172.20.0.113, they get the application that is installed on my machine. What I want to know how to do, is serve files outside the LAN (i.e. so I can pick it up at home)

My machine is 172.20.0.113, running Win XP SP2
Our main file server is 172.20.0.50, running Server 2003
And I know my WAN address, which is a static IP.

Also of importance would be, I have OneOrZero task management system installed at C:/XAMPP/htdocs and Moodle installed on C:/XAMPP/htdocs/moodle/, but I only want Moodle to be visible outside the company.

I've trawled the web for about 2 days, and I am getting more and more confused, so I throw myself on your mercy.

If I can provide any more details, please tell me.

Any help is extremely appreciated!
ade1982
 
Posts: 4
Joined: 04. February 2008 23:39

Postby Izzy » 05. February 2008 00:28

Using IP-based virtual hosts will do the trick for you.

Here is some reading for you to get a handle on this subject.
http://httpd.apache.org/docs/2.2/vhosts/
http://httpd.apache.org/docs/2.2/vhosts/examples.html

You configure vhosts in the httpd-vhosts.conf file in
.\xampp\apache\conf\extras\

Also you will need to add your IP entries into the Windows hosts file here:
C:\WINDOWS\system32\drivers\etc\

Have a go at it and if you get stuck paste your vhosts conf file and we can take a look at it for you.

You can also do a search in the XAMPP for Windows forum under the Category: Apache Friends in English using the keyword vhost for some other examples that might assist.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby ade1982 » 06. February 2008 00:23

Thanks, Izzy.

I had seen this in the forum before I posted, but I wasn't sure whether it was the same thing I should be looking at.

Will try it out when we have put some stuff together, and let you know how it goes :)
ade1982
 
Posts: 4
Joined: 04. February 2008 23:39

Postby ade1982 » 06. February 2008 15:36

Ok, feeling slightly thicker than before,

here is my httpd-conf file

Code: Select all
         
        NameVirtualHost 172.20.0.113
   NameVirtualHost 81.137.43.209

   <VirtualHost 172.20.0.113 81.137.43.209>
       DocumentRoot /moodle/
       ##ServerName server1.domain.tld
       ##ServerAlias server1
       </VirtualHost>


and my hosts file:

Code: Select all
127.0.0.1       localhost

69.57.152.127 pagead2.googlesyndication.com
81.137.43.209
172.20.0.113



As I stated before, my internal IP address is 172.20.0.113, and the domain server (running on the main server) is 172.20.0.50. The external IP address is 81.137.43.209, and XAMPP is installed at

C:\XAMPP\htdocs\

the moodle package I want to host is installed at

C:\XAMPP\htdocs\moodle\

I am now only looking to host one application, which is moodle. I just don't know how to publish it to the internet.

Going crazy, and trying to read the documents, but not knowing what the terms mean in the document are making it unbearably complicated!

P.S. When it is supposed to work, should the changes take place immediately, or after how long?

and also, I would like to make it look pretty (as in, if someone types http://moodle, it will display the relevant page) internally [obviously the IP address will suffice externally]?
ade1982
 
Posts: 4
Joined: 04. February 2008 23:39

Postby Izzy » 07. February 2008 00:14

We are using IP-based VirtualHosts so no need for the NameVirtualHost directive.

First we set the server to listen on port 80 from all IPs.

Then we keep the localhost as the default so you can go to the XAMPP Welcome Page.

Next we add your local access to Moodle.

Then we add your external access to Moodle.
(I have kept them both in separate VirtualHost containers for ease of trouble shooting)

Try this in your
C:\xampp\apache\conf\extra\httpd_vhosts.conf

Code: Select all
Listen 80

<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost 172.20.0.113>
ServerName moodle
DocumentRoot "C:/XAMPP/htdocs/moodle"
<Directory "C:/XAMPP/htdocs/moodle" >
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost 81.137.43.209>
ServerName moodle
DocumentRoot "C:/XAMPP/htdocs/moodle"
<Directory "C:/XAMPP/htdocs/moodle" >
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


Save the file and restart the Apache server.

The Windows hosts file:
Code: Select all
127.0.0.1 localhost
172.20.0.113 moodle
81.137.43.209 moodle
69.57.152.127 pagead2.googlesyndication.com


You will also have to make sure that your ISP does not block port 80 from external users, some do not allow their clients to run servers.

Make sure that all the ports that XAMPP uses are open to your network.

Internally http://moodle should work now with the above configuration.
http://81.137.43.209 should work for external access.
http://localhost and http://127.0.0.1 should work and take you to the XAMPP Welcome Page but only from your PC - others on the network and external users don't have access to localhost loop back addresses on your PC.

The above configuration should be available as soon as you have restarted the Apache server after making the above changes - make sure the C:\xampp\apache\conf\httpd.conf file is still the XAMPP installation default - no changes in this file since installing XAMPP.

Always make a backup of conf and ini files before making edits so you can revert if things go belly up.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby ade1982 » 07. February 2008 22:26

Thanks, Izzy.

I am now getting the message about not being able to bind to port 80, and the rest of it

: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down


and so Apache effectively won't start.

After looking around the net, I saw one of the reasons might be Skype, which I don't have installed on that machine, IIS is not installed on the machine, nor is Apache 1, but IIS is installed on the main server for another application (Windows Update Services)

Is there anything there that might pose a clue as to why apache won't start / shuts down immediately, or will posting a result of a netstat -ab(?) trace make any sense to anyone who can help?

Getting semi-desperate now, as it is taking up a huge amount of time for a minor project!

Thanks in advance, all.

Ade
ade1982
 
Posts: 4
Joined: 04. February 2008 23:39

Postby Izzy » 08. February 2008 01:16

Run .\xampp\xampp-portcheck.exe and it will show you what is hogging the port that XAMPP requires exclusively.

Unless you can change the port of the offender then you will have to change the port that XAMPP listen on - which will add another part to your browser's address - for example http://localhost:8080 and to all your other addresses which will always have to be added to access your server.

Obviously it would be a better proposition to change the offender if at all possible than to have this added hassle.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 134 guests