Hosting Websites with WampDeveloper Pro

WampDeveloper Pro is configured, by default, to pick up and answer all requests it receives (access to websites is not blocked)... But these requests have to get to WampDeveloper Pro first.

If a website works locally but not remotely, the requests are not reaching WampDeveloper Pro's Apache Service.

When a request comes in to the system that WampDeveloper Pro is running on, WampDeveloper Pro will check the "Host" header (specifies the domain name) of the HTTP request and cross-reference it to the websites it contains (via the website's domain name and aliases data). When there is a match, WampDeveloper Pro returns that specific website. When there is no match, WampDeveloper Pro returns the "DefaultWebsite"...

So as long as the request reaches the server, or more specifically the WampDeveloper Pro's running Apache Service, something (a website) will be returned.

Local Development

To develop and test a website locally you can do so using a non-registered (made up, fake) domain name.

Simply add a website using a Primary Domain Name such as: www.example.com and you will be able to access URL http://www.example.com/ in your browser. No other steps are required.

Just make sure the LocalDNS Tab has "Locally Resolve" selected/checked for that website (it will be selected, by default).

Hosting to the internet

To host a website, you'll need to buy/register a domain name, and using your registrar's (GoDaddy, Namecheap, etc) control panel, set up the DNS of that domain to point/resolve to the public IP address of your server.

Using WampDeveloper Pro, assign your website the registered domain name into the Primary Domain Name field.

You can also have a website respond directly to an IP address by assigning your website a Domain Alias of the IP address. Just make sure to de-select the "Forward to Primary Domain: All Aliases" option in the Websites Tab for your website, if the primary domain name is not registered or is not reachable.

You'll also need to:

Hosting to the LAN Network

To reach the server from other LAN systems, you would have to either:

To let WampDeveloper Pro know that you want to assign a specific website to either the hostname or the server's LAN IP address, go to WampDeveloper Pro's Websites Tab, select your website, click 'Update' and add either the hostname or the IP address to the 'Domain Aliases' field (comma separated list: example.com, computer-name, 192.168.1.1). Try not to update the 'Primary Domain Name' field as that will result in a renaming/moving of your website's DocumentRoot/webroot folder and could interfere with your webapp installations (sometimes webapps hardcode initial install paths directly into configuration files and the database, rather than detecting the paths at run-time).

If using a hostname or IP address to access a website, and this website cannot be accessed via the Primary Domain Name (domain name is not real or dns is not set up), you must also de-select the 'forward all aliases to primary domain name' option... Go to the Websites Tab, select your website, click update, then un-select "Forward to Primary Domain: All Aliases".

Note that Windows has a native firewall that, by default, will block incoming port 80 (HTTP port) requests. You'll need to unblock that port. And if your server has other firewall software installed, that software will probably behave the same way and will need to be adjusted.

Also note that the router might not be configured to assign each system the same LAN IP address day to day... Every time your system is powered on, a new LAN IP address might be assigned (yesterday it was 192.168.1.1, today its 192.168.1.2). You'll want to log into your router and have it assign a specific IP address bound to the MAC address of the system's network card ("nic" card). This is sometimes called "Static DHCP" or "Static Lease".

Local DNS Resolve

The "Local DNS" tab only works for the system WampDeveloper Pro is installed on.

The Local Resolve settings have no effect on anything but how a request from the local system, [and usually] to the local system, is resolved... Either via a real domain name DNS lookup/resolve, or via a domain name lookup in the local Windows Hosts file.

These settings have no effect on requests done from outside the local system.

Notes

A Blank Page

WampDeveloper Pro's default behavior is to answer all requests coming in... But these requests have to reach WampDeveloper Pro first.

If you are getting a blank page, you can be sure that the request is either: not going to the right IP, is being mis-routed, or is being blocked.

If a request comes in that does not have a corresponding website (same domain name or domain alias) you will get the "DefaultWebsite" website back.

DefaultWebsite

If you are accessing your website from another computer, and instead you get "DefaultWebsite", then the domain name, IP address, or host-name you are using in the URL (from the other computer), has not been added to the website's "Domain Aliases" field (select website, click 'Update' button).

For example: if you are accessing your website via URL http://192.168.0.1, then you will need to add 192.168.0.1 as a Domain Alias. The same goes for any domain/hostname used.

Dynamic & Static IP Addresses

Your ISP probably assigns you a "dynamic" IP address which will change day to day, as opposed to a "static" IP address which does not change...

You can get around this fact by using a "Dynamic DNS" service provider (such as no-ip.com) which will keep the dynamic IP synced with your domain's DNS records. Otherwise, every time you power down the router (or if there is no router, the server), your "dynamic" IP might change but your DNS records will still resolve the domain to the previous IP address.

DNS Resource Records

When setting up your domain's DNS, you'll want to create an "A" record for example.com and also either an A or a CNAME record (doesn't really matter) for www.example.com.

Public IP vs LAN IP

Be careful not to confuse the public IP, sometimes also called the WAN (Wide Area Network) IP by the router, with the LAN (Local Area Network) IP of the server.

Access of Website via IP Alias

If you are hosting a website via a "Domain Alias" of an IP address, chances are your Primary Domain Name is fictitious (not real). In this case you must not have WampDeveloper Pro forward the Domain Aliases to the Primary Domain Name.

Go to the Websites Tab, select your website, click update, then un-select "Forward to Primary Domain: All Aliases".

Otherwise, your browser will go to the website via the ip address URL (which is one of the website's aliases), and since the forward option is selected, WampDeveloper Pro will immediately sends back a redirect request (redirect to primary domain name), which your browser does not know how to resolve (because domain name is not registered / DNS is not set up) or can't reach.

Detecting Public IP Address

For your convenience, you can have WampDeveloper Pro try to detect the public IP address via the System Tab, "Detect Public" button. This is not guaranteed to be the true public IP, but is correct 95% of the time.

DNS Propagation Times

DNS changes can take a few hours to propagate through the internet and reach the different ISPs Nameservers (DNS servers).

Browser DNS Cache

Browsers (IE, Firefox, Chrome, Opera) cache DNS resolve values (domain name to ip).

If you browse to a domain name, then locally resolve it / or make changes to it's DNS records, you might get the old result back next time you check...

Close all the browser windows and try again. At worst, the local resolve cache will keep for 15 minutes. Example: a website has no DNS set up, user tests out / tries the domain name in the browser, gets nothing back, uses WampDeveloper Pro to set up the website, tries again to access domain name in browser, gets nothing back.

NSLookup

You can view your domain's DNS records by... Run 'cmd.exe', and in the new window (command line window) type in: "nslookup www.example.com" (no quotes). Check the last IP line. This is the IP your ISP's Nameservers think is pointing to the domain name right now.