Run public python http.server on Plesk

Question:

I have a script that runs with python3 -m http.server 8080 locally without issues on http://localhost:8080

I wanted to make it live on my web server running Plesk/Ubuntu.

First, I installed python3 via SSH and tried to run the same and it returns:
View in browser: http://localhost:8080 however, nothing happens when trying http://example.com:8080 in browser (just times out).

Also tried to enable the Plesk module by installing apt install libapache2-mod-python and checking the Python box in "Hosting Settings" for that domain.

enter image description here

Tried with python3 -m http.server --bind 127.0.0.1 8080 and python3 -m http.server --bind example.com 8080 to no avail.

Tried setting up <VirtualHost> but figured it won’t help since that’s apache…

Any ideas how to make the python server visible from outside on port 8080 with Plesk?

Asked By: Miro

||

Answers:

Turns out all I needed to do is add port 8080 to Plesk firewall.

Tools & Settings > Firewall > Modify Plesk Firewall Rules > Add Custom Rule

enter image description here

Don’t forget to apply changes!
enter image description here

Answered By: Miro
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.