Can't connect to XAMPP Apache server from LAN or outside

21,520

Ok, there are only a few points to get up you and running:

1) Make sure you have XAMPP up and running. From a browser on your machine you should be able to browse to your site using 127.0.0.1. If that works then your apache is at least running and serving pages.

2) To keep the httpd.conf simple, the top part of the VirtualHost should look like:

<VirtualHost *:80>
    ServerName example.com [your domain name]
    DocumentRoot /var/www/html [path to your root directory of your web site]
    ...

The *:80 tells it to listen on all IPs on port 80 ServerName tells it that it should apply this VirtualHost to any request for that domain name. NOTE: ServerAlias www.example.com is common as otherwise it won't automatically figure out that www. is the same thing. DocumentRoot tells it where it gets the files from.

3) Ensure your network settings are correct - your static IP, gateway, etc. so that a
connection can actually be made to your machine.

4) From an external machine, ping your IP to ensure that you can at least reach it and there is no networking issue between the two computers. Then using the other machine open a browser and in the URL field type in http://[your external ip]. You may be an apache welcome page or a Forbidden page or various things depending on your settings, but it should at least give you something. That signifies that the external machines browser is making a valid connection to your webserver.

5) DNS is now the final step to resolve. You want to minimally link an A Record to your IP Address. Usually you handle this at the registrar that you bought your domain name from, unless you manually change the nameservers that you're using. If you use the registrars there's a place usually called 'DNS Management' or 'Zone File' or something similar. You want to route the tld (top-level-domain) to your machine's IP address. You should also add a CNAME Record for www that points to the tld. Example:

example.com        A        1.2.3.4
www.example.com    CNAME    example.com.

That's pretty much the simplicity of it. Your milestones are A) Making sure that you can get apache working locally, then B) making sure your machine can be hit from across the internet or internal network and C) getting the DNS set up so they can use the domain instead of an IP.

Share:
21,520

Related videos on Youtube

nathan
Author by

nathan

Updated on September 18, 2022

Comments

  • nathan
    nathan over 1 year

    I've installed XAMPP and it's working fine, localhost is showing everything it needs to (I have a wiki located in /mediawiki/ and a mini site of static webpages at /site/). Running Windows 7.

    Before I tried to access my server from outside my network, I could access my wiki from within my network just fine by going to the machine's ip address (192.168.1.69/mediawiki). But I want this wiki to be available from outside the network. I've spent ~10 hours now googling things and trying to get it to work.

    My server hands out static ip addresses, so I don't need any DynDNS update software, but I have set up a DNS account for my (WAN) ip address (let's call it 75.x.x.x) from freedns.afraid.org (because of free). I've tried editing the httpd.conf file a bunch of times trying to get it to work, setting ServerName 192.168.1.69, 75.x.x.x, the DNS domain I set, 0, *--nothing's worked, I can't connect ot the server from outside the network. To top it off, now I can't connect to the server from withing the network, even though I've restored the backup of the original httpd.conf (that I made just in case).

    httpd.conf is set to listen on port 80, and all the forwarding is taken care of, both on the router and through Windows Firewall (both incoming and outgoing just in case). I tried it with another open port but still nothing. At this point, I don't know what I'm missing because I feel like I've tried everything I've been able to google up.

    • ravi yarlagadda
      ravi yarlagadda almost 12 years
      What error do client browsers give when attempting to connect?