• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • 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.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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