How to Set up server and ufw Firewall - griffinsnest/tech-Jorunal-1 GitHub Wiki
How to make a hoc http server in python
To set up an HTTP server with python in the command prompt is rather simple. All you have to do is input the command python3 -m http.server and it will automatically start running a python-based server. If you run the command as is, it will by default start running the server on port 8000. To make it so that it is running a server on a specific other port, simply input the same command again followed by the alternative port number, e.g. in this lab's case python3 -m http.server 1337.
How to enable the ufw Firewall and add ports to get through it
To enable the ufw firewall on your machine, you simply have to use the command sudo ufw enable. Since enabling the firewall is a root action you'll need to input the password of the account to get this command to work. This enables and by extension starts the firewall on the device, which unless a specific port is allowed access through makes any connection between the on-device server and an off-device client impossible. To allow access through the firewall, simply use the command sudo ufw all (port number)/tcp. This will allow traffic through the specified port in any client/server connections.