0

I am setting up an Apache2 server on Ubuntu to host a Flask website. The issue that I am having is that Apache is only serving my files on an "Index of /" page, rather than serving my site. I am new to Apache and have tried setting up my site by following many online tutorials and guides. I think that I have it mostly set up but there is a misconfiguration somewhere that I cannot detect.

site.wsgi:

#!/usr/bin/python3.6

import sys
sys.path.insert(0, "/var/www/site.org/")
import app as application
if __name__ == '__main__':
    application.run()

site.conf:

LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so

<VirtualHost *:80>

    DocumentRoot /var/www/site.org

    ServerAdmin user@email.com

    ServerName site.org
    ServerAlias www.site.org

    ErrorLog /var/www/site.org/logs/error.log
    CustomLog /var/www/site.org/logs/access.log combined

    WSGIScriptAlias /site.org /var/www/site.org/site.wsgi
    WSGIDaemonProcess site.org python-home=/var/www/site.org/env python-path=/var/www/site.org/app user=www-data group=www-data threads=5

    Alias /static/ /var/www/site.org/app/static

    <Directory /var/www/site.org>
        WSGIProcessGroup site.org
        WSGIApplicationGroup %{GLOBAL}
        WSGIScriptReloading On
        Require all granted
    </Directory>

</VirtualHost>

Directory Tree:

site.org
├── app
│   ├── __init__.py
│   ├── models.py
│   ├── routes.py
│   ├── site.db
│   ├── static
│   └── templates
├── application.py
├── config.py
├── env
├── requirements.txt
└── site.wsgi
Senrab
  • 101
  • 2

1 Answers1

0

I am not an expert on Apache but from the folder structure you provided there is no file for apache to load, for example; index.html or index.php.

Within your virtualhost include;

DirectoryIndex index.html index.php

This will tell Apache what files to load and what priority to give them.

You will also need to create an appropriate index.html or .php file.

See this link for information: https://httpd.apache.org/docs/2.4/mod/mod_dir.html