3 ms·
> I didn't want to install and configure Apache or nGinx. In fact, I didn't want any configuration. Personally, in that case, I'd use: python3 -m http.server
by BossingAround 5y ago
> I didn't want to install and configure Apache or nGinx. In fact, I didn't want any configuration.
Personally, in that case, I'd use:
python3 -m http.server
- rascul 5y agoThere are many similar options. I think that awhile ago there may have been a list of one liner web servers posted to HN. Either way, I've been using python's for years and it's just muscle memory now.
- em500 5y agoBig list of http static servers: https://gist.github.com/willurd/5720255 https://gist.github.com/willurd/5720255
- nickjj 5y agoThat's my goto solution for a simple server if I'm testing something locally but it has issues dealing with concurrent requests in its simple form. For example I ran a simple hello world test service on Kubernetes once using Python's http.server. Just having 3 Kubernetes health checks happen on regular intervals would routinely cause the server to respond with errors. I think what ends up happening is if you have 2 requests coming in within a short enough period of time one of them will fail. You have to use a more complicated threaded http server if you want a zero dependency solution.
- adamddev1 5y ago`npm install -g live-server` Also works great (but a bit bulkier sure).