Based on the flask mod_wsgi documentation:
In RHEL:
sudo dnf install mod_wsgi httpd
In Ubuntu:
sudo apt-get install libapache2-mod-wsgi-py3
sudo a2enconf mod-wsgi
sudo a2enmod rewrite
Add the configuration, adapting it to your system, from these files:
- apache.config - Replace the values in brackets and add to your apache/httpd config
- In RHEL:
- Config in:
/etc/httpd/conf.d/[site].conf
- Restart httpd:
sudo systemctl restart httpd
- Config in:
- In Ubuntu:
- Config in:
/etc/apache2/sites-available/[site].conf
- Enable site:
sudo a2ensite [site]
- Restart apache2:
sudo service apache2 restart
- Config in:
- In RHEL:
- app.wsgi - the WSGI script to place in the path specified in the config file that runs the Flask app
Check the web server documentation for details.
Note: The files use /var/www/app
as the root of the app.