How can I make my home PC a web server?
Solution 1:
You need to forward requests to the webserver (port 80, probably) to your machine (.1.2). You configure this on your router.
Solution 2:
You are going to need to do a few things:
Make sure to change your router password and lock down your router, since you will be making your IP publicly available, the configuration of your router is very important. It probably would be a good idea to download the latest firmware to prevent security exploits.
Forward your web requests to your local machine, on your router. Look for a "port forwarding" option, which will force all requests on a certain port your router to be forwarded to your machine's IP address
try to ensure that your internal IP address remains the same. Some advanced routers can reserve a certain IP address for your computer's MAC address, so make this configuration to your router. If you router software cannot do this, you probably will have to update your internal IP address in the "port forwarding" mapping whenever your computer reboots (or gets another IP address somehow). You can also confgure your computer to use a hard coded internal IP address, but this could add additional issues too out of scope to discuss here.
if you're ISP provides you with a dynamic IP address, it can get to be a hassle sending your friend your new IP address every time it changes, so you could sign up for a dynamic IP service (www.dyndns.org) which will have a program that will update a dns entry for you. Most modern routers have this server built into the firmware, you can look for it then you don't have to run the software on your machine.
for security reasons, reduce the number of other requests that are being sent to this machine (e.g. windows file sharing, ftp, bit torrent, etc etc).
Port 80 is the default port used by web browsers and servers, so when you access a site http://www.mysite.com, you're requesting it on port 80)
Port 8009 is the default port used by tomcat, so if you're using tomcat, you may want to replace port 80 with port 8009 below.
You don't have to do any other port configuration for the web server on your local machine, you can have your router do the mapping and leave the web server running on port 80 or 8009 on your machine.
Example, say i want to use port 12345, then I can configure my router so that any requests on port 12345 on my router will be sent to port 80 (or 8009) on my local machine. This allows you to be able to access our web server on that machine simply by going to http://localhost/ or http://localhost:8009 . Other internal machines on your network will have to access by Ip address (http://192.168.1.x) or you can edit yoru hosts files and assign a name.
It's important to know that most ISP's block port 80 ( and other common ports) from being used as a web server, so even if you have everything configured property on your end, your friend still may not be able to hit port 80 on your machine. This is typically done so that ISP customers will fork out more cash for their "business" offerings. Because of this, you will probably have to open your router on another port if you really want your friend to access your web server. You'll want to stay away from low number ports, and you'll want to avoid using the port your router is configured from as well.
If you do all of the above correctly, you should be able to have a stable URL (such as http://myusername.dyndns.org:12345 ) that your friends can bookmark and use at will
Solution 3:
You need to port forward HTTP (tcp/80) to your pc (192.162.1.2). Each router is slightly different, so you'll need to find some instructions for your specific model.
If your router supports UPnP, then (They're screen scraping - not using UPnP) you could also do it automagically as needed (better security) for $$.
Solution 4:
You have to forward your tomcat port on your router. The default tomcat port is 8080. It is better if you change your tomcat port to 80. Follow the following steps to change your tomcat port
- Open the folder tomcat\conf on your computer
-
Now with a text editor you have to open and modify server.xml. Here you have to identify the following line (line 184) and you modify it so that changes from:
to:
<Http10Connector port="80"
secure="false"
maxThreads="100"
maxSpareThreads="50"
minSpareThreads="10" />
- Startup the web server
From your router forward port 80 from your router to your pc ip address. Once this is done, tell your friend to access your website by using http://xx.xx.xx.xx/webAppName. Here xx.xx.xx.xx is your IP address and webAppName is your website project.
By default the ISPs will block port 8080 so you have to change the port tomcat uses.