如何调试我的 wsgi 配置文件

如何调试我的 wsgi 配置文件

我正在尝试安装一个服务器inginious(用于自动评分的程序)。安装中的一个步骤是配置 Apache2 以使用 mod_wsgi。以下是配置文件inginious.conf

<VirtualHost *:8081>
       LoadModule wsgi_module /usr/local/lib/python3.6/dist-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-l$
       WSGIScriptAlias / "/usr/local/bin/inginious-webapp"
       WSGIScriptReloading On

       Alias /static /usr/local/lib/python3.6/dist-packages/inginious/frontend/static

        <Directory "/usr/local/bin">
            <Files "inginious-webapp">
                Require all granted
            </Files>
        </Directory>

        <DirectoryMatch "/usr/local/lib/python3.6/dist-packages/inginious/frontend/static">
            Require all granted
        </DirectoryMatch>

       ServerAdmin [email protected]
       DocumentRoot /var/www/inginious
</VirtualHost>

<VirtualHost *:8082>
        LoadModule wsgi_module /usr/local/lib/python3.6/dist-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-$
        WSGIScriptAlias / "/usr/local/bin/inginious-webdav"
        WSGIScriptReloading On

        <Directory "/usr/local/bin">
            <Files "inginious-webdav">
                Require all granted
            </Files>
        </Directory>
</VirtualHost>

我使用 启用了它a2ensite inginious,然后systemctl reload apache2。 没有错误/var/log/apache2/error.log。 但netstat -tupln |grep 80返回

tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      1500/python3
tcp6       0      0 :::80                   :::*                    LISTEN      852/apache2

这表明没有人在监听端口 8081 和 8082。另一方面,apache2 -M显示以下内容:

wsgi_module (shared)

apache2 -S展示了

*:8081                 104.248.40.179 (/etc/apache2/sites-enabled/inginious.conf:1)
*:8082                 104.248.40.179 (/etc/apache2/sites-enabled/inginious.conf:22)

这表明 Apache2 确实读取了 wsgi 配置。

这是error.log重新加载 Apache2 之后的文件:

[Thu Feb 18 18:57:46.994117 2021] [socache_shmcb:info] [pid 12632] AH00830: Shared memory socache initialised
[Thu Feb 18 18:57:46.994139 2021] [ssl:info] [pid 12632] AH01887: Init: Initializing (virtual) servers for SSL
[Thu Feb 18 18:57:46.994146 2021] [ssl:info] [pid 12632] AH01876: mod_ssl/2.4.29 compiled against Server: Apache/2.4.29, Library: OpenSSL/1.1.1
[Thu Feb 18 18:57:46.994214 2021] [mpm_prefork:notice] [pid 12632] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Thu Feb 18 18:57:46.994219 2021] [mpm_prefork:info] [pid 12632] AH00164: Server built: 2020-08-12T21:33:25
[Thu Feb 18 18:57:46.994222 2021] [core:notice] [pid 12632] AH00094: Command line: '/usr/sbin/apache2'
[Thu Feb 18 18:57:47.997715 2021] [wsgi:info] [pid 16827] mod_wsgi (pid=16827): Initializing Python.
[Thu Feb 18 18:57:48.000974 2021] [wsgi:info] [pid 16831] mod_wsgi (pid=16831): Initializing Python.
[Thu Feb 18 18:57:48.004725 2021] [wsgi:info] [pid 16830] mod_wsgi (pid=16830): Initializing Python.
[Thu Feb 18 18:57:48.006544 2021] [wsgi:info] [pid 16829] mod_wsgi (pid=16829): Initializing Python.
[Thu Feb 18 18:57:48.011627 2021] [wsgi:info] [pid 16828] mod_wsgi (pid=16828): Initializing Python.
[Thu Feb 18 18:57:48.063143 2021] [wsgi:info] [pid 16831] mod_wsgi (pid=16831): Attach interpreter ''.
[Thu Feb 18 18:57:48.067184 2021] [wsgi:info] [pid 16830] mod_wsgi (pid=16830): Attach interpreter ''.
[Thu Feb 18 18:57:48.072145 2021] [wsgi:info] [pid 16831] mod_wsgi (pid=16831): Imported 'mod_wsgi'.
[Thu Feb 18 18:57:48.072434 2021] [wsgi:info] [pid 16827] mod_wsgi (pid=16827): Attach interpreter ''.
[Thu Feb 18 18:57:48.073417 2021] [wsgi:info] [pid 16830] mod_wsgi (pid=16830): Imported 'mod_wsgi'.
[Thu Feb 18 18:57:48.080393 2021] [wsgi:info] [pid 16829] mod_wsgi (pid=16829): Attach interpreter ''.
[Thu Feb 18 18:57:48.083918 2021] [wsgi:info] [pid 16829] mod_wsgi (pid=16829): Imported 'mod_wsgi'.
[Thu Feb 18 18:57:48.084460 2021] [wsgi:info] [pid 16827] mod_wsgi (pid=16827): Imported 'mod_wsgi'.
[Thu Feb 18 18:57:48.088675 2021] [wsgi:info] [pid 16828] mod_wsgi (pid=16828): Attach interpreter ''.
[Thu Feb 18 18:57:48.091951 2021] [wsgi:info] [pid 16828] mod_wsgi (pid=16828): Imported 'mod_wsgi'.

我的配置有什么问题?

相关内容