• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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