|
How to Start Python's http.server in the Background as a Windows Service |
Automatically run the HTTP server whenever your machine boots; serve your files 24x7 without having to log in
Last Updated on July 24, 2026
Python's http.server
module provides a quick and easy way to serve a folder,
without needing to install and configure a full blown web server.
Even though it's not recommended for production use, starting Python's HTTP server immediately
at boot may be a great option for internal projects.
To install http.server as a Windows Service with AlwaysUp:
-
Download and install Python, which includes http.server, if necessary:
-
Download and install AlwaysUp, if necessary.
-
Start AlwaysUp.
-
Select Application > Add to open the Add Application window:
-
On the General tab:
-
In the Application field, enter the full path to the python executable, python.exe.
Since we installed Python in the default location, this is
"C:\Users\Mike Jones\AppData\Local\Programs\Python\Python314\python.exe"
on our machine.
-
In the Arguments field, enter -m http.server. That will invoke the HTTP server.
-
In the Start in directory field, enter the folder you would like to serve.
We're sharing our Music folder, from "C:\Music".
-
In the Start the application field, select Automatically, but shortly after the computer boots.
This will delay Python by a couple minutes at boot, to give critical services (e.g. networking) enough time to fully initialize.
-
And in the Name field, enter the name that you will call this application in AlwaysUp.
We went with "http.server":
-
Move to the Logon tab and enter the user name and password of the Windows account in which you installed and configured Python:
-
Click over to the Startup tab and check the Ensure that the Windows Networking components have started box.
This informs AlwaysUp that http.server needs the regular TCP/IP networking stack to operate. We don't want Python to start too soon.
-
When http.server is running as a windows service, it will only be visible in the
isolated Session 0.
You can switch to Session 0 to see it,
but another option is to save http.server's output to a file.
To configure file capture, switch to the Extras tab and enter the full path to your log file in the
Capture output to this log file section.
We recommend choosing to automatically trim the file to prevent it growing out of hand:
-
We're now done configuring the service, so click the Save button.
In a couple of seconds, an application called http.server (or whatever you called it) will show up in the AlwaysUp window.
It's not yet running though and the state will be "Stopped":
-
To start http.server, choose Application > Start "http.server".
The state should transition to "Running" after a few seconds and http.server should be serving your folder:
Now is a good time to open your browser and check that you can access your files. Everything looked good on our machine:
-
That's it! Next time your computer boots, your http.server service will be launched immediately, before anyone logs on.
Feel free to edit the entry in AlwaysUp and add more advanced options.
For example, boost the priority of python.exe, send an email if the server fails, add a web server health check, and much more.
Python http.server not working properly as a Windows Service?
Check the log file you captured in step 8 for errors and warnings.
Consult the AlwaysUp Troubleshooter — our online tool that can help you resolve the most common problems encountered when running an application as a Windows Service.
From AlwaysUp, select Application > Report Activity > Today to bring up an HTML report detailing the interaction between AlwaysUp and the HTTP server. The AlwaysUp Event Log Messages page explains what each message means.
Browse the AlwaysUp FAQ for answers to commonly asked questions and troubleshooting tips.
Contact us and we will be happy to help!
|
Over 97,000 installations, and counting!
|
 |
|
Rock-solid for the past 20+ years!
|
Fully Compatible with 160+ Applications...
|