If you ever need to use a local web server on Windows, it’s always convenient just to turn on IIS server in your system. But for a security reason, that’s not feasible to have that in your corporate environment. However, IIS is not the only option available, if you have any of development tools installed in your system, you’re still in luck.
This post will show how you can activate a built-in web server if you have any (or a combination of) of the following: PHP, Python and/or Node.js.
With the assumption that we’re using port 8000 for the built-in server, here are the command line to activate the built-in web server from each platform.
IMPORTANT: DO NOT USE FOR PRODUCTION. This should be used only for development.
Always type in the command line from the web folder.
PHP
If you don’t have it installed yet, here’s how to install PHP on Windows.
php -S localhost:8000
Python 2
This is strictly posted for a legacy system. If you don’t have Python 2 yet, it’s better just to install the newer Python 3 for this purpose.
python -m SimpleHTTPServer 8000
Python 3
Make sure Python 3 is installed.
python -m http.server 8000
Node.js npm
Before you can activate the web server, you need to install express first.
npm install express —save (just need to install this one time)
Then you can activate it by typing this command:
node http.js
Further Reading
How to Install IIS on Windows 10
How to Install Python on Windows Server
How to Install PHP on Windows 10
Leave a Reply