Make your own PC web server

Published 10/30/2015 04:23:32 AM  |  Last update 5/27/2021 12:23:35 PM
Tags: web server, server, pc, asp.net, iis

As a web developer, you may need a physical server to host your websites, where you have everything set up on your own using the powerful hardware of your choice. Renting a dedicated server is the most popular answer for this issue. It, however, would require a large budget. With a “strong enough” PC in hand and an internet service ownership, you have got everything needed for a dedicated server with zero additional costs. In this article, I will show you how to make your own PC your web server.

All you need is to have web server service installed on your PC. If you have a Linux PC, please check this post for how to install NGINX web server on Linux server. For a Windows PC, please follow the steps, below.

  1. Turn on the World Wide Web services- Go to “Control Panel\All Control Panel Items\Programs and Features”, select “Turn windows features on or off”. Under “Internet Information Service”, please turn on “World Wide Web services”. You may want to check also “ASP.NET”, which is for asp.net web pages, or CGI, an integrated php engine for php web pages, in the section “Application development feature”.
  2. If you are using PHP, do not forget to put the php.ini file of your own settings in your website folder.
  3. Let the Web server talk to people on internet- Go to “Control Panel\All Control Panel Items\Windows Firewall”, select “Allow a program or feature through windows firewall”, please make "World Wide Web Services" exceptional under public network. Remember to forward all web requests from people over internet to your PC.

You can use nginx or other web server software Instead of IIS on Windows. Please google to find more information about that. If you are using nginx or any other software, please do not forget to allow them over the windows firewall.


Problem with setting web server using IIS

My machine is running Windows 7 Ultimate. Here's what I've done (successfully) so far:
  • Installed IIS 7.5 with PHP over FastCGI
  • Got it working! When I go to http://localhost/index.php , my PHP scripts run fine.
  • Ran ipconfig to find out that my local IP address is 192.168.1.102. I confirmed that http://192.168.1.102/index.php functions exactly like the localhost address above. Went into my router administration (I have a Linksys WRT54G2) and set up port forwarding on port 80 to 192.168.1.102. Now port 80 is forwarding to my machine.
  • Set up an inbound rule in Windows Firewall to allow all activity on port 80.
  • Found out what my outside IP address is from Google. Let's call it XXX.XX.XX.XX. However, when I try to go to http://XXX.XX.XX.XX/index.php from my own machine, or from a computer far away and not on my network, either way... I get nothing. It tries to connect for awhile (unsuccessfully) but eventually just gives up.
Here's what I'm wondering: What am I missing? What did I forget/overlook? How do I get this working and accessible outside my own local network? Assuming I do get this working, how can I then use a port other than port 80? What changes would I need to make (e.g. IIS, Windows Firewall, router administration, etc.) in order to make that possible? Thanks very much in advance!

Discussion: Is it a problem with IIS? No, it is not because he has his website up and accessible from other hosts in his LAN. He just only could not access his website from internet. Hence, the problem is because the web server service was not set to be by-passed the firewall. Please check the "Let the Web server talk" section in my post for this problem. Thank you for reading my article.

© 2024 blog.tinyray.com  by tinyray