I have a flask app that want to host in an apache2 server using wsgi interfase between Python Flask and Apache2. I have cloned the app into www/var/catalogapp/ and also have the config file of Apache(catalogapp.conf) as well as the wsgi file of my application(catalogapp.wsgi)

I follow all the steps to deploy the app on Apache Server that I configured on Amazon Lightsail based in this tutorial:


The flask app should run on port 80 with a public IP provided from Amazon Lightsail. The issue is that when I load the IP in the browser I get the Connection Timed Out error. Is like the server never could reach and always I get a Timed Out Connection message.

I check my logs messages with the command: sudo tail /var/log/apache2/error.log and have the following messages:

[Thu Jan 31 21:27:02.060526 2019] [mpm_event:notice] [pid 15619:tid 140477135951744] AH00491: caught SIGTERM, shutting down
[Thu Jan 31 21:27:03.080506 2019] [wsgi:warn] [pid 16351:tid 140306872121216] mod_wsgi: Compiled for Python/3.5.1+.
[Thu Jan 31 21:27:03.080540 2019] [wsgi:warn] [pid 16351:tid 140306872121216] mod_wsgi: Runtime using Python/3.5.2.
[Thu Jan 31 21:27:03.080967 2019] [mpm_event:notice] [pid 16351:tid 140306872121216] AH00489: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/3.5.2 configured -- resuming normal operations
[Thu Jan 31 21:27:03.080981 2019] [core:notice] [pid 16351:tid 140306872121216] AH00094: Command line: '/usr/sbin/apache2'
I have created the catalogapp.conf file that is in /etc/apache2/sites-available directory and also the catalogapp.wsgi file that is in the /var/www/catalogapp/ directory with all the information about the IP address and tied with the instrucctions described in the link above

This is my catalogapp.conf file:

<VirtualHost *:80>
                ServerAdmin nferrari3444@gmail.com
                WSGIScriptAlias / /var/www/catalogapp/catalogapp.wsgi
                <Directory /var/www/catalogapp/catalogapp/>
                        Order allow,deny
                        Allow from all
                Alias /static /var/www/catalogapp/catalogapp/static
                <Directory /var/www/catalogapp/catalogapp/static/>
                        Order allow,deny
                        Allow from all
                ErrorLog ${APACHE_LOG_DIR}/error.log
                LogLevel warn
                CustomLog ${APACHE_LOG_DIR}/access.log combined

And here is my catalogapp.wsgi file:

activate_this = '/var/www/catalogapp/catalogapp/venv/bin/activate'
execfile(activate_this, dict(__file__=activate_this))

import sys
import logging
                    format='%(asctime)s %(levelname)s %(message)s',

from catalogapp import app as application
application.secret_key = 'Add your secret key'

The goal of this is to have the catalogapp application hosted and deployed in apache2 server within the IP address that user write in the browser.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.