I want to set up very simple http server whith replaces few keywords in single html file and send it in repspond to request to clients. Python's http.server looks good for me but in documentation I found:
Warning http.server is not recommended for production. It only implements basic security checks.
and in source code:
SECURITY WARNING: DON'T USE THIS CODE UNLESS YOU ARE INSIDE A FIREWALL -- it may execute arbitrary Python code or external programs.
Do you know any way to create safty http server which ports could be foreword via firewall to internet?
Python Simple HTTP Server Now, use shift+right click . Your will find option to open command prompt in that directory. Just click on that and open command prompt there. However, if you are using Ubuntu, just right click into that directory and open terminal.
Since Python Simple HTTP Server is running solely on Python code (as far as I know, again.) you got nothing to worry about. (Unless you are also logging HTTP requests using different applications or methods.)
Python3 SimpleHTTPServer is a built-in HTTP server in which you don't have to install and configure anything. Therefore, SimpleHTTPServer is a very convenient tool. You can use the Python SimpleHTTPServer to turn any directory into a simple HTTP web server.
If its a Python web application, there are several options available for HTTP servers in Python. Among the safe one's are Gunicorn, Nginx WSGI, mod_wsgi. A list is available here. I'll take mod_wsgi as an example. The official documentation states there are two ways to install this package & both are safe for production deployments:
The package can be installed in two different ways depending on your requirements. The first is as a traditional Apache module installed into an existing Apache installation.The second way of installing mod_wsgi is to install it from PyPi using the Python pip command. This builds and installs mod_wsgi into your Python installation or virtual environment. Both installation types are suitable for production deployments.
According to the docs, the best option is to use: Apache + mod_wsgi + docker.
For mod_wsgi, you will need to configure Apache 2.4 and both Python 2 & 3 are supported. The requirements are stated here.
The Apache web server is widely used in production applications. The Apache HTTP Server Project is among the oldest and well maintained for 20 years. You can read more about it here. As for implementing security, you should read this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With