• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Please beaware of a breaking change in the REST API on the current Plesk release (18.0.62).
    Starting from Plesk Obsidian 18.0.62, requests to REST API containing the Content-Type header with a media-type directive other than “application/json” will result in the HTTP “415 Unsupported Media Type” client error response code. Read more here

Question Flask app on port 80

rayder99

New Pleskian
Server operating system version
Ubuntu 20.04.6
Plesk version and microupdate number
Obsidian 18.0.61
Hello Everybody,

I followed this manual to create a flask app and run it in Plesk Obsidian:
Input - Guide for Python Flask App deployement

But my problem is, that this app only runs on port 5000, or whichever i define in the parameters.
It does not run on port 80, so the standard port for http traffic - I get this message:
"Port 80 is in use by another program. Either identify and stop that program, or start the server with a different port."

How can i change the default port, that traffic for port 80 will be redirected to 5000? - or whichever port I choose
And as Step 2: how can i make the https traffic as well to go to my flask app?

Many thanks in advance
 
That where proxying request comes into play. You can run Flask (or any other application) on a different port (example 5000) and proxy all requests made to a domain on port 80 (and 443 for https) to 5000.

Simply by disabling proxy mode in Plesk and adding this Ngnix directive to the additional directives of the domain. You can adapt the directive for your specific needs and configuration.
NGINX:
<Location />
ProxyPass http://127.0.0.1:5000
ProxyPassReverse http://127.0.0.1:5000
</Location>
 
Back
Top