Score:0

Apaches virtual host config suddenly not working anymore; how to debug?

de flag

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!

Gmck avatar
tr flag
error.log contains nothing at all - even in debug level?
Standard avatar
de flag
@Gmck: No new info when opening the webpage, but some other notices which I added on the question.
in flag
Your `DUMP_VHOSTS` shows that you have vhosts in two config files. You only posted one. What's with the other one?
Standard avatar
de flag
@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
Score:0
de flag

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.

Gmck avatar
tr flag
000-default probably took precedence. Connections never made it to your MogliFlask site. Glad to see you solved it.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.