Thursday, April 5, 2018

Setting Up A Simple Website Using Tomcat & Namecheap

In this post, I will share the steps I used to create a very simple website using Tomcat webserver, and Namecheap DNS.

Web server configuration

1. Download the latest tomcat.

  • The version in this case is 9.0.6

2. Create the following directory –


3. Paste the tomcat package directory inside the MyWebsites directory

4. Rename the package to the directory name of the website

This directory will serve the website

5. Download jdk -

This step is not necessary depending on how java is installed on the machine. I prefer deploy java in this manner.

6. Deploy jdk in the following directory –

Java directory

7. Create setenv.bat file and place it in the \bin directory. Specify the java home in the file.


8. Create an index.html file and drop it in the following directory –


9. Run the startup.bat in the \bin directory

Running startup.bat will show the environment variables

10. Access localhost:8080 in the browser


Router Configuration

1. Gather the internal IP address of the machine that is running the tomcat server –


2. Open the router configuration page and find the port forwarding settings. This can be typically accessed at

3. Add a new rule for forwarding http traffic to port 8080

Port forwarding

4. Go to

5. Type in the port and click on the Check Port button

Port status

Namecheap host record configuration

1. Go to and take note of the external IP address (also known as the WAN IP)

2. Go to Advanced DNS configuration

3. In the host records section, create the following:

  • Type: A record; Host: @; Value: <external-ip>; TTL: Automatic
  • Type: URL Redirect Record; Host: www; Value: http://<domain>:8080 Masked META (We use this record because will be redirected, and “work” in the browser)

Host records

The record for the wildcard exists for creating virtual hosts in Tomcat, which I will cover in a later document.

Problems I encountered

I have a Netgear C6300BD, and the router is running Firmware Version V2.05.18

It turns out that this particular router does not support loopback functionality, therefore when you have port forwarding setup, accessing http://<external-ip>:8080 does not work from within the network.

The best to test if the setup is working is by accessing your website from outside the network, and the most convenient way to do this is through a mobile device with.

1 comment:

  1. Nice post ! Thanks for sharing valuable information with us. Keep sharing..
    and also we are providing E-Learning Portal Videos for students and working Professionals
    Hurry Up! Bag All Courses in Rs - 10000 /- + taxes
    41 Career building courses.
    Designed by 33 industrial experts
    600+ hours of video Content
    DevOps and Cloud E-Learning Portal


Had to include word verification to prevent spam.