0

out of the blue my virtual host config doesn't work anymore. So my setup sould be quite easy: On Port 80, I want to deliver two WSGI apps, and that's the .conf file I'm using:

<VirtualHost *:80>
        ServerName mogli.secret.de

        #########
        # RESTAPI
        #########

        WSGIScriptAlias /mogli/api /opt/mogli/restapi/app.wsgi
        <Directory /opt/mogli/restapi/>
                Options FollowSymLinks
                AllowOverride None
                Require all granted
        </Directory>

        #########
        # WEBAPP
        #########

        WSGIScriptAlias /mogli/webapp /opt/mogli/webapp/app.wsgi
        <Directory /opt/mogli/webapp/>
                Options FollowSymLinks
                AllowOverride None
                Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel debug
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

So like I said I had it working, so I don't know really what changed. The Apache server starts without a problem. I also ran a2ensite MogliFlask successfully. But when I open my webapp, it just says 404 Not found. (The default index page at / works, btw)

The access log just says the same:

"GET /mogli/api/doc HTTP/1.1" 404 507 "-" "Mozilla/5.0 [...]"

The error log says nothing at all when I open the webpage, there are only some notices:

[Thu Oct 14 07:29:36.906477 2021] [core:notice] [pid 159:tid 140444421547136] AH00094: Command line: '/usr/sbin/apache2'
[Thu Oct 14 07:30:11.780214 2021] [mpm_event:notice] [pid 159:tid 140444421547136] AH00491: caught SIGTERM, shutting down
[Thu Oct 14 07:52:09.914051 2021] [mpm_event:notice] [pid 165:tid 140689596499072] AH00489: Apache/2.4.38 (Debian) mod_wsgi/4.6.5 Python/3.7 configured -- resuming normal operations

When running apachectl -t -D DUMP_VHOSTS I get this status:

VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server mogli.secret.de (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost mogli.secret.de (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost mogli.secret.de (/etc/apache2/sites-enabled/MogliFlask.conf:1)

I'm running a Debian 10.

Things I tried so far:

  • Restarting the server
  • Reinstalling Apache2 and WSGI mod
  • Googling how to actually debug this kind of error without success

So my queston is - how do I track my error? What's wrong with the VirtualHost config? Any type of hint would be helpful, I'm very lost on this. Thank you!

Standard
  • 53
  • 7
  • error.log contains nothing at all - even in debug level? – Gmck Oct 13 '21 at 19:23
  • @Gmck: No new info when opening the webpage, but some other notices which I added on the question. – Standard Oct 14 '21 at 06:41
  • Your `DUMP_VHOSTS` shows that you have vhosts in two config files. You only posted one. What's with the other one? – Gerald Schneider Oct 14 '21 at 06:54
  • @GeraldSchneider it's the 000-default, I just found out that that's the problem (see my own answer). That's really weird, as I had it worked for months without having the need to disable it. Whatever - it works now. Thank you – Standard Oct 14 '21 at 07:03

1 Answers1

0

Okay so I found the solution:

sudo a2dissite 000-default

I don't know why it worked before without disabling 000-default, but mystery solved.

Standard
  • 53
  • 7
  • 000-default probably took precedence. Connections never made it to your MogliFlask site. Glad to see you solved it. – Gmck Oct 14 '21 at 19:08