Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python SimpleHTTPServer in production

I want to serve static files with Python. Is the Python 3 http.server suitable for use in production? If not, why not? And what are my alternatives?

like image 737
zxz Avatar asked Oct 28 '15 13:10

zxz


1 Answers

Quoting documentation https://docs.python.org/3/library/http.server.html#module-http.server

Warning: http.server is not recommended for production. It only implements basic security checks.

First of all you don't need python at all to serve static files. Just use a real HTTP Server like Apache or NGinx. If you want a quick solution just look for a docker container with a pre-configured image suitable for your needs. Here is the NGinx. Definitely docker is a must have tool that you will not regret to learn.

$ docker run --name mysite-nginx -v /mysite:/usr/share/nginx/html:ro -p 80:80 -d nginx
like image 196
Leo Avatar answered Sep 25 '22 07:09

Leo