0

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:

https://www.digitalocean.com/community/tutorials/how-to-deploy-a-flask-application-on-an-ubuntu-vps#step-four-%E2%80%93-configure-and-enable-a-new-virtual-host

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>
                ServerName 3.82.189.241
                ServerAdmin nferrari3444@gmail.com
                WSGIScriptAlias / /var/www/catalogapp/catalogapp.wsgi
                <Directory /var/www/catalogapp/catalogapp/>
                        Order allow,deny
                        Allow from all
                </Directory>
                Alias /static /var/www/catalogapp/catalogapp/static
                <Directory /var/www/catalogapp/catalogapp/static/>
                        Order allow,deny
                        Allow from all
                </Directory>
                ErrorLog ${APACHE_LOG_DIR}/error.log
                LogLevel warn
                CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

And here is my catalogapp.wsgi file:

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


#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr,
                    level=logging.DEBUG,
                    format='%(asctime)s %(levelname)s %(message)s',
                    filename='/tmp/catalogapp.log',
                    filemode='w'))
sys.path.insert(0,"/var/www/catalogapp/")
sys.path.insert(0,"/var/www/item_catalog/catalogapp")

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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.