Hosting Websites with Wamp-Developer
Wamp-Developer 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 Wamp-Developer first.
If a website works locally but not remotely, the requests are not reaching Wamp-Developer's Apache Service.
When a request comes in to the system that Wamp-Developer is running on, Wamp-Developer 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, Wamp-Developer returns that specific website. When there is no match, Wamp-Developer returns the "DefaultWebsite"...
So as long as the request reaches the server, or more specifically the Wamp-Developer's running Apache Service, something (a website) will be returned.
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 Wamp-Developer, 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:
- 1. Make sure your ISP (if hosting from home) does not block incoming port 80 (HTTP port) connections. Most ISPs do not.
- 2. Make sure your router (if you are using one) forwards incoming port 80 requests to the specific LAN IP of the system. This is accomplished via the router's "port forward" settings. Log into the router and "port forward" port 80 WAN (Wide Area Network / internet) to the LAN (Local Area Network) IP of the server (LAN IP is the "Local Area Network" IP address: usually an address range in 192.168.xxx.xxx). This way, requests reaching the router will get routed/forwarded to the proper LAN system. By default, your router does not know what to do with / where to send an incoming HTTP request.
- 3. Make sure your router (if you are using one) is assigning LAN IPs via "Static DHCP" or "Static Lease". This will permanently assign a specific LAN IP address to the specific MAC address of the system's network card ("nic" card). Otherwise, your router could assign a different LAN IP to the server each time the server is powered on.
- 4. Make sure your Windows Firewall (Windows comes with a native firewall) is configured to allow incoming port 80 requests. Windows Firewall will block incoming port 80 requests by default.
Hosting to the LAN Network
To reach the server from other LAN systems, you would have to either:
- A) Access your website via the server's hostname (see System Tab info) - example: http://computer-name
- B) Access your website via server's LAN IP (see System Tab info) - example: http://192.168.1.1
- C) Edit all the other LAN system's Hosts files, and resolve there a fake domain name to the LAN IP of the server.
- D) Use your network's DNS servers (nameservers) to resolve a domain name to the LAN IP of the Wamp-Developer server.
To let Wamp-Developer know that you want to assign a specific website to either the hostname or the server's LAN IP address, go to Wamp-Developer'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 Wamp-Developer 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.
A Blank Page
Wamp-Developer's default behavior is to answer all requests coming in... But these requests have to reach Wamp-Developer 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.
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 Wamp-Developer 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, Wamp-Developer 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 Wamp-Developer 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 Wamp-Developer to set up the website, tries again to access domain name in browser, gets nothing back.
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.