• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

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>
 
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>
Please excuse my lack of understanding: where exactly do I have to add this proxy-pass information? which file? or which menu/settings?
 
You can add them under the Domain in Plesk, when you go to Hosting & DNS > Apache & nginx Settings under
Additional nginx directives.
In that same menu 1st disable the option "Proxy mode" if it is enabled
 
Back
Top