Click here to Skip to main content
13,455,897 members (50,971 online)
Click here to Skip to main content
Add your own
alternative version


18 bookmarked
Posted 8 Apr 2016

HostMe - Hosting Static Web Pages Has Never Been Easier

, 18 Jun 2017
Rate this:
Please Sign up or sign in to vote.
HostMe is a simple one EXE application that can host your static web pages easily. It can run either as a console or as a Windows service with the minimal amount of effort from your side.

Source on GitHub


Not every time you host a web site you need a server side logic. When all you need is just static web pages hosting using something that just hosts your site, and does nothing else, can do the work for you.


Many web sites today are written as single page applications. Usually, those sites don't need a traditional server side, the client performs some http requests to some services, maybe even microservices, just to get the relevant data. The rest of the work is performed in the browser. In such a case, hosting static web pages is enough.

In this article, I want to introduce an application that I wrote (HostMe) that does exactly this.

All you need to do to host static pages with HostMe is just to run a single EXE file (no any kind of installation is required).

Using HostMe

  1. Download HostMe.
  2. Put HostMe.exe in the same directory where your index.html file is found:

  3. Run HostMe.exe as administrator (The default hosting port is on port 80, in order to host on port 80, you need to run as administrator. If you would like to change the default port, look here):

  4. Now you can open your browser and type localhost:

You can see that all site files were loaded perfectly, even the javascript code. If you want to try it by yourself, you can download this example.

Pay attention that you don't need to restart HostMe at any point, any addition of new file or change to existing file will be effected immediately.

Run HostMe as a Windows Service

Run the cmd as administrator (in order to install Windows service, you must be administrator), go to the folder where HostMe.exe is found and type:

HostMe.exe -install

Now you have a Windows service running that will host your site and start automatically on every system boot. You can see it in the services.msc:

You can enter localhost again in the browser, and it works like a charm:

If you want to uninstall the service, all you need to do is this:

HostMe.exe -uninstall

You even don't need to stop the Windows service first.


HostMe writes to log files every request it gets. You can see it in the logs folder that will be created in the same directory as the EXE.

Please pay attention that since the logs folder is found in the same directory as HostMe.exe and you use the default configuration, any user can access your logs files. If you don't want this to be possible, change the root directory in the site as explained in the next section.

Change the Default Configuration

The default configuration of HostMe is to run on port 80 and to host what is found in the same directory where the EXE is found.

In order to change this behavior, create a new json file called HostMe.config.json in the same directory as the EXE. The file's content should be in this format:

  "Path": "C:\MySite\siteRoot",
  "Port": 8080

The path is the path to the root folder of the site. It can be either relative to the EXE or absolute.

The port is the port on which the site will be hosted.

If you omit one of the properties, it will get its default value (the port will be 80 and the root folder will be the folder of the EXE).

So, if you just want to change the root folder of the site to siteRoot, and your EXE is found in C:\MySite, you can write this:

   "Path": "C:\MySite\siteRoot"

or that:

    "Path": "siteRoot" 

What's Next?

The code of HostMe is actually an open source and can be found here.

If you want some explanations about the code, I will be glad to write another article with explanations.

Feel free to write any suggestions or issues you have found.

Useful Links


This article, along with any associated source code and files, is licensed under The MIT License


About the Author

Code Cleaner
Israel Israel
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionMy vote of 5 Pin
Qwertie12-Apr-16 15:11
memberQwertie12-Apr-16 15:11 
Questionmono Pin
keeny_cp212-Apr-16 6:46
memberkeeny_cp212-Apr-16 6:46 
AnswerRe: mono Pin
Code Cleaner12-Apr-16 8:07
memberCode Cleaner12-Apr-16 8:07 
GeneralRe: mono Pin
Qwertie12-Apr-16 15:06
memberQwertie12-Apr-16 15:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03-2016 | 2.8.180321.1 | Last Updated 18 Jun 2017
Article Copyright 2016 by Code Cleaner
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid