Navigation Bar

Monday, March 28, 2016

To access your web application from any machine on the internet

Deploy you application on JBOSS.

start the JBOSS web server with the following command.

run.bat -b 0.0.0.0
- this indicates the web application is accessible from any ip address.

Make sure the host server ip is accessible from any other machine having the same ISP provider.

ping ipaddress

telnet <ipaddress> <port>

Verify the web application is running on the said port using the netstat command. So if your application is running on port 9090 run the following on the cmd prompt on the web application server.

netstat -an | find "9090"

Ensure port 9090 is not blocked in firewall. On windows XP, bypass firewall for port 9090 as follows.

StartControl PanelWindows Firewall
Click on Exceptions tab
Click "Add Port"
Fill in:
Name: JBoss 9090
Port number: 9090
Select TCP
Click OK
Click OK again to close firewall window.

Login to the admin login of your ISP. The user id for Jio is admin. You can get the password from your ISP and verify the WLAN Partition is turned off.

Navigate to NetworkWirelessAccess Points → ap1 (Jioprime_2.4)
Checked WLAN Partition → was already OFF ❌ (not the issue)

Run the tracert command from the destination machine to get a reply from the source. 

C:\Users\winni>tracert 152.143.53.175
Tracing route to WINNITH [152.143.53.175]
over a maximum of 30 hops:
  1     7 ms    11 ms     4 ms  WINNITH [152.143.53.175]
Trace complete.

if the hops get timed out it means something on the XP machine is blocking incoming traffic.

C:\Users\winni>tracert 152.143.53.175
Tracing route to 152.143.53.175 over a maximum of 30 hops
  1     *     myhostname [152.143.55.155]  reports: Destination host unreachable.
Trace complete.

Last check left is to check the antivirus installed. 
I was having NORTON antivirus. Uninstalled Norton 360 and telnet to port 9090 worked.
Root cause of the problem was
Norton 360 installation was blocking incoming connections.

Now I am able to access the web application using

http://152.143.xx.xxx:9090/resume/

How to Access your web application using url

In the below section I will describe how to start accessing the site with a url instead of ip address.
  • For this the first thing you will need to do is get a static ip address from your ISP for the machine hosting the web application.
  • You will also need to buy a domain from a web hosting site like godaddy , hostinger, namecheap.com or domains.google.com etc.
  • Login to your domain account and in your domain registrar's DNS settings, add a record
Type           A
Name          @
Value         <ip address of your web application server>  

  • Enable port forwarding in the admin login of your ISP.
Go to Port Forwarding
Forward external port → server's local IP:port

For JioFiber broadband after login with admin user and password
Go to
Security -> Firewall -> Port Forwarding -> Add
Action                                    Allow Always
Services                                 HTTP
Source IP Address                 Any
Destination IP Address          <ip address of your web application server>
Internal Port Type                  Single
Internal Port                           80

  • Open Firewall Port on the Server
You can now access the application with url and port as follows
http://myappname:9090/projectname

If you want to bypass using the port, you can put a reverse proxy in from of your web application.
Nginx is a reverse proxy application.

You can go to the nginx site https://nginx.org/en/download.html and download the version of nginx applicable for your Windows version.
In the ngiins installation directory/conf/nginx.conf file add the following lines

server {
        listen       80;
        server_name  theoraclereference.in;
       
        rewrite ^/$ http://theoraclereference.in/resume permanent;

        location /<projectname> {
            proxy_pass   http://152.143.53.175:9090/projectname;
        }

error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
}
Now from any other machine you can access the web application as follows
http://myappname/projectname
What Nginx does is it listens for incoming requests on default port 80 and then redirects the request to the url mentioned in location /<projectname>

God's Word for the day

Wisdom and Foolishness
Like a house in ruins is wisdom to a fool,
  and to the ignorant, knowledge is talk that has no meaning.
To a senseless person, education is fetters on his feet,
  and like manacles on his right hand.
A fool raises his voice when he laughs,
  but the wise smile quietly.
To the sensible person, education is like a golden ornament,
  and like a bracelet on the right arm.
Sirach 21:18-21


Gospel teachings of Jesus

The parable of the weeds among the wheat
He put before them another parable:
  "The kingdom of heaven may be compared to someone
who sowed good seed in the field; but while everybody was asleep,
  an enemy came and sowed weeds among the wheat and then went away.
So when the plants came up and bore grain, then the weeds appeared as well.
  And the slaves of the householder came and said to him,
'Master did you not sow good seed in your field?
  Where then did these weeds come from ?'
He answered, 'An enemy has done this'.
  The slaves said to him,
'Then do you want us to go and gather them?'
But he replied, 'No for in gathering the weeds,
  you would uproot the wheat along with them.
Let both of them grow together until the harvest.
  And at harvest time I will tell the reapers,
'Collect the weeds first and bind them in bundles to be burned,
  But gather the wheat into my barn."
Mathew 13:24-30

No comments:

Post a Comment