0

I'm getting the following <body>404 - File not found</body> response from my apache server every time after more than a day without sending requests.

My setup is:

  • OS: Ubuntu 16.04
  • Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g mod_wsgi/4.3.0 Python/2.7.12
  • Django==1.4.3 (I know it is old, but it really doesn't matter, as the errors are before it reach the python code)

configuration:

<IfModule mod_ssl.c>

<VirtualHost *:1234>
    # Django WSGI bridge
    WSGIScriptAlias / /path/to/my/code.py
    WSGIApplicationGroup %{GLOBAL}
    # WSGISocketPrefix /var/run/wsgi

    ServerAdmin user@server
    ServerName server.example.com
    ServerAlias my.example.com
    DocumentRoot /var/www

    <Directory />
        Options FollowSymLinks
        AllowOverride None
        AuthName "Password Required"
        AuthType Basic
        AuthUserFile /etc/apache2/httpd.passwd
        require valid-user
    </Directory>

    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    CustomLog /var/log/apache2/wsgi-access.log combined
    ErrorLog /var/log/apache2/wsgi-api-error.log
    LogLevel core:info
    LogLevel info

    SSLProxyEngine on

    # HSTS
    Header always set Strict-Transport-Security "max-age=15768000"

    #   SSL Engine Switch:
    #   Enable/Disable SSL for this virtual host.
    SSLEngine on
    SSLCertificateFile    /etc/ssl/certs/cert.pem
    SSLCertificateKeyFile /etc/ssl/private/privkey.pem
    SSLCertificateChainFile /etc/ssl/certs/chain.pem

</VirtualHost>

</IfModule>

All I get in the error logs (wrong port - 443 instead of 1234 in the original log, also when it is working fine):

[Sun Jul 07 10:35:09.535783 2019] [ssl:info] [pid 26787:tid 140005775230720] [client 10.0.0.2:40798] AH01964: Connection to child 197 established (server server.example.com:443)
[Sun Jul 07 10:35:09.560223 2019] [wsgi:info] [pid 26787:tid 140005775230720] [client 10.0.0.2:40798] mod_wsgi (pid=26787, process='', application=''): Loading WSGI script '/path/to/my/code.py'.
[Sun Jul 07 10:35:14.400252 2019] [ssl:info] [pid 26788:tid 140005766838016] [client 10.0.0.2:44526] AH01964: Connection to child 262 established (server server.example.com:443)
[Sun Jul 07 10:35:14.425193 2019] [wsgi:info] [pid 26788:tid 140005766838016] [client 10.0.0.2:44526] mod_wsgi (pid=26788, process='', application=''): Loading WSGI script '/path/to/my/code.py'.
[Sun Jul 07 10:36:45.730694 2019] [ssl:info] [pid 26788:tid 140005640947456] [client 10.0.0.2:44526] AH01992: SSL library error 1 reading data
[Sun Jul 07 10:36:45.730730 2019] [ssl:info] [pid 26788:tid 140005640947456] SSL Library Error: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init
[Sun Jul 07 10:37:47.995849 2019] [ssl:info] [pid 26788:tid 140005783623424] [client 10.0.0.2:43232] AH01964: Connection to child 260 established (server server.example.com:443)

the access log looks like this:

10.0.0.2 - user [07/Jul/2019:10:35:09 +0000] "POST /api HTTP/1.1" 400 4314 "-" "python-requests/2.22.0"
10.0.0.2 - user [07/Jul/2019:10:35:14 +0000] "POST /api HTTP/1.1" 404 4224 "-" "python-requests/2.22.0"
10.0.0.2 - user [07/Jul/2019:10:35:14 +0000] "POST /api HTTP/1.1" 404 425 "-" "python-requests/2.22.0"
10.0.0.2 - user [07/Jul/2019:10:35:14 +0000] "POST /api HTTP/1.1" 404 425 "-" "python-requests/2.22.0"
10.0.0.2 - user [07/Jul/2019:10:35:14 +0000] "POST /api HTTP/1.1" 404 425 "-" "python-requests/2.22.0"
10.0.0.2 - user [07/Jul/2019:10:35:14 +0000] "POST /api HTTP/1.1" 404 425 "-" "python-requests/2.22.0"
10.0.0.2 - user [07/Jul/2019:10:35:14 +0000] "POST /api HTTP/1.1" 404 425 "-" "python-requests/2.22.0"
10.0.0.2 - user [07/Jul/2019:10:35:14 +0000] "POST /api HTTP/1.1" 404 425 "-" "python-requests/2.22.0"
10.0.0.2 - user [07/Jul/2019:10:35:14 +0000] "POST /api HTTP/1.1" 404 425 "-" "python-requests/2.22.0"
10.0.0.2 - user [07/Jul/2019:10:35:14 +0000] "POST /api HTTP/1.1" 404 425 "-" "python-requests/2.22.0"
10.0.0.2 - user [07/Jul/2019:10:35:14 +0000] "POST /api HTTP/1.1" 404 425 "-" "python-requests/2.22.0"

Restarting the service solves the problem (for the next 24 hours), so my guess is the configuration is not (totally) broken, and the data sent is ok too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.