0

I am trying to run a flask app on apache wsgi, here is my virtualhost file:

<VirtualHost *:80>
            ServerName 127.0.0.1
            ServerAdmin [email protected]
            WSGIScriptAlias / /var/www/classifier/classifier.wsgi
            <Directory /var/www/classifier/classifier/>
                    WSGIApplicationGroup %{GLOBAL}
                    Order allow,deny
                    Allow from all
            </Directory>
            Alias /templates/ /var/www/classifier/classifier/templates/
            <Directory /var/www/classifier/classifier/templates/>
                    WSGIApplicationGroup %{GLOBAL}
                    Order allow,deny
                    Allow from all
            </Directory>
            ErrorLog /var/www/classifier/error.log
            LogLevel warn
            CustomLog /var/www/classifier/access.log combined</VirtualHost>

and here is my wsgi file:

#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/classifier/")

from classifier.server import app as application
application.secret_key = ''

when I try to access the server through the external ip address, I am getting Apache2 Ubuntu Default Page. What am I doing wrong here?

~

2 Answers 2

2

In my situation, if you want to access the server via the external IP address, you have to disable the default site configuration first.

sudo a2dissite 000-default.conf
service apache2 restart
Sign up to request clarification or add additional context in comments.

Comments

1

You shouldn't be using 127.0.0.1 as ServerName for the VirtualHost. It should be the actual host name for the site which it will be accessed using.

If you only want to be able to access it via an IP address, or localhost, you need to add your configuration to the default (first) VirtualHost configuration, not create a separate one.

BTW, it is strongly recommended you use daemon mode of mod_wsgi rather than embedded mode as you are.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.