I have been trying to get an SSL certificate for a site using LetsEncrypt, "a free, automated, and open certificate authority (CA), run for the public’s benefit". There is an ACME shell script that is meant to make the process of using LetsEncrypts API easier to receive an SSL certificate. One of their methods requires you to enter in your domain name, and the webroot of your application.
acme.sh --issue -d example.com -w /home/wwwroot/example.com
However, when I try to enter this command, it says that it was unable to verify the domain. I added a --debug flag to the script command, and received this, but am not sure where the problem lies.
[Mon Sep 11 05:05:01 UTC 2017] Using config home:/home/doc4design/.acme.sh
[Mon Sep 11 05:05:01 UTC 2017] DOMAIN_PATH='/home/doc4design/.acme.sh/doc4design.com'
[Mon Sep 11 05:05:01 UTC 2017] Using ACME_DIRECTORY: https://acme-v01.api.letsencrypt.org/directory
[Mon Sep 11 05:05:01 UTC 2017] _init api for server: https://acme-v01.api.letsencrypt.org/directory
[Mon Sep 11 05:05:01 UTC 2017] ACME_KEY_CHANGE='https://acme-v01.api.letsencrypt.org/acme/key-change'
[Mon Sep 11 05:05:01 UTC 2017] ACME_NEW_AUTHZ='https://acme-v01.api.letsencrypt.org/acme/new-authz'
[Mon Sep 11 05:05:01 UTC 2017] ACME_NEW_ORDER='https://acme-v01.api.letsencrypt.org/acme/new-cert'
[Mon Sep 11 05:05:01 UTC 2017] ACME_NEW_ACCOUNT='https://acme-v01.api.letsencrypt.org/acme/new-reg'
[Mon Sep 11 05:05:01 UTC 2017] ACME_REVOKE_CERT='https://acme-v01.api.letsencrypt.org/acme/revoke-cert'
[Mon Sep 11 05:05:01 UTC 2017] Le_NextRenewTime
[Mon Sep 11 05:05:01 UTC 2017] _on_before_issue
[Mon Sep 11 05:05:01 UTC 2017] Le_LocalAddress
[Mon Sep 11 05:05:01 UTC 2017] Check for domain='doc4design.com'
[Mon Sep 11 05:05:02 UTC 2017] _currentRoot='/home/doc4design/webapps/django_2016/doc4_2016'
[Mon Sep 11 05:05:02 UTC 2017] _saved_account_key_hash is not changed, skip register account.
[Mon Sep 11 05:05:02 UTC 2017] Read key length:
[Mon Sep 11 05:05:02 UTC 2017] _createcsr
[Mon Sep 11 05:05:02 UTC 2017] Single domain='doc4design.com'
[Mon Sep 11 05:05:02 UTC 2017] Getting domain auth token for each domain
[Mon Sep 11 05:05:02 UTC 2017] Getting webroot for domain='doc4design.com'
[Mon Sep 11 05:05:02 UTC 2017] _w='/home/doc4design/webapps/django_2016/doc4_2016'
[Mon Sep 11 05:05:02 UTC 2017] _currentRoot='/home/doc4design/webapps/django_2016/doc4_2016'
[Mon Sep 11 05:05:02 UTC 2017] Getting new-authz for domain='doc4design.com'
[Mon Sep 11 05:05:02 UTC 2017] _init api for server: https://acme-v01.api.letsencrypt.org/directory
[Mon Sep 11 05:05:02 UTC 2017] ACME_KEY_CHANGE='https://acme-v01.api.letsencrypt.org/acme/key-change'
[Mon Sep 11 05:05:02 UTC 2017] ACME_NEW_AUTHZ='https://acme-v01.api.letsencrypt.org/acme/new-authz'
[Mon Sep 11 05:05:02 UTC 2017] ACME_NEW_ORDER='https://acme-v01.api.letsencrypt.org/acme/new-cert'
[Mon Sep 11 05:05:02 UTC 2017] ACME_NEW_ACCOUNT='https://acme-v01.api.letsencrypt.org/acme/new-reg'
[Mon Sep 11 05:05:02 UTC 2017] ACME_REVOKE_CERT='https://acme-v01.api.letsencrypt.org/acme/revoke-cert'
[Mon Sep 11 05:05:02 UTC 2017] Try new-authz for the 0 time.
[Mon Sep 11 05:05:02 UTC 2017] url='https://acme-v01.api.letsencrypt.org/acme/new-authz'
[Mon Sep 11 05:05:02 UTC 2017] payload='{"resource": "new-authz", "identifier": {"type": "dns", "value": "doc4design.com"}}'
[Mon Sep 11 05:05:02 UTC 2017] RSA key
[Mon Sep 11 05:05:02 UTC 2017] GET
[Mon Sep 11 05:05:02 UTC 2017] url='https://acme-v01.api.letsencrypt.org/directory'
[Mon Sep 11 05:05:02 UTC 2017] timeout
[Mon Sep 11 05:05:02 UTC 2017] _CURL='curl -L --silent --dump-header /home/doc4design/.acme.sh/http.header '
[Mon Sep 11 05:05:02 UTC 2017] ret='0'
[Mon Sep 11 05:05:02 UTC 2017] POST
[Mon Sep 11 05:05:02 UTC 2017] url='https://acme-v01.api.letsencrypt.org/acme/new-authz'
[Mon Sep 11 05:05:02 UTC 2017] _CURL='curl -L --silent --dump-header /home/doc4design/.acme.sh/http.header '
[Mon Sep 11 05:05:03 UTC 2017] _ret='0'
[Mon Sep 11 05:05:03 UTC 2017] code='201'
[Mon Sep 11 05:05:03 UTC 2017] The new-authz request is ok.
[Mon Sep 11 05:05:03 UTC 2017] entry='"type":"http-01","status":"pending","uri":"https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012","token":"jSwY3$
[Mon Sep 11 05:05:03 UTC 2017] token='jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c'
[Mon Sep 11 05:05:03 UTC 2017] uri='https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012'
[Mon Sep 11 05:05:03 UTC 2017] keyauthorization='jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c.KZ04ehApOrSMwkeVbG2UT-klFpwOPf_pDEdqVcHf4XM'
[Mon Sep 11 05:05:03 UTC 2017] dvlist='doc4design.com#jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c.KZ04ehApOrSMwkeVbG2UT-klFpwOPf_pDEdqVcHf4XM#https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i$
[Mon Sep 11 05:05:03 UTC 2017] vlist='doc4design.com#jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c.KZ04ehApOrSMwkeVbG2UT-klFpwOPf_pDEdqVcHf4XM#https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3$
[Mon Sep 11 05:05:03 UTC 2017] ok, let's start to verify
[Mon Sep 11 05:05:03 UTC 2017] Verifying:doc4design.com
[Mon Sep 11 05:05:03 UTC 2017] d='doc4design.com'
[Mon Sep 11 05:05:03 UTC 2017] keyauthorization='jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c.KZ04ehApOrSMwkeVbG2UT-klFpwOPf_pDEdqVcHf4XM'
[Mon Sep 11 05:05:03 UTC 2017] uri='https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012'
[Mon Sep 11 05:05:03 UTC 2017] _currentRoot='/home/doc4design/webapps/django_2016/doc4_2016'
[Mon Sep 11 05:05:02 UTC 2017] ACME_REVOKE_CERT='https://acme-v01.api.letsencrypt.org/acme/revoke-cert'
[Mon Sep 11 05:05:02 UTC 2017] Try new-authz for the 0 time.
[Mon Sep 11 05:05:02 UTC 2017] url='https://acme-v01.api.letsencrypt.org/acme/new-authz'
[Mon Sep 11 05:05:02 UTC 2017] payload='{"resource": "new-authz", "identifier": {"type": "dns", "value": "doc4design.com"}}'
[Mon Sep 11 05:05:02 UTC 2017] RSA key
[Mon Sep 11 05:05:02 UTC 2017] GET
[Mon Sep 11 05:05:02 UTC 2017] url='https://acme-v01.api.letsencrypt.org/directory'
[Mon Sep 11 05:05:02 UTC 2017] timeout
[Mon Sep 11 05:05:02 UTC 2017] _CURL='curl -L --silent --dump-header /home/doc4design/.acme.sh/http.header '
[Mon Sep 11 05:05:02 UTC 2017] ret='0'
[Mon Sep 11 05:05:02 UTC 2017] POST
[Mon Sep 11 05:05:02 UTC 2017] url='https://acme-v01.api.letsencrypt.org/acme/new-authz'
[Mon Sep 11 05:05:02 UTC 2017] _CURL='curl -L --silent --dump-header /home/doc4design/.acme.sh/http.header '
[Mon Sep 11 05:05:03 UTC 2017] _ret='0'
[Mon Sep 11 05:05:03 UTC 2017] code='201'
[Mon Sep 11 05:05:03 UTC 2017] The new-authz request is ok.
[Mon Sep 11 05:05:03 UTC 2017] entry='"type":"http-01","status":"pending","uri":"https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012","token":"jSwY3$
[Mon Sep 11 05:05:03 UTC 2017] token='jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c'
[Mon Sep 11 05:05:03 UTC 2017] uri='https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012'
[Mon Sep 11 05:05:03 UTC 2017] keyauthorization='jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c.KZ04ehApOrSMwkeVbG2UT-klFpwOPf_pDEdqVcHf4XM'
[Mon Sep 11 05:05:03 UTC 2017] dvlist='doc4design.com#jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c.KZ04ehApOrSMwkeVbG2UT-klFpwOPf_pDEdqVcHf4XM#https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i$
[Mon Sep 11 05:05:03 UTC 2017] vlist='doc4design.com#jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c.KZ04ehApOrSMwkeVbG2UT-klFpwOPf_pDEdqVcHf4XM#https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3$
[Mon Sep 11 05:05:03 UTC 2017] ok, let's start to verify
[Mon Sep 11 05:05:03 UTC 2017] Verifying:doc4design.com
[Mon Sep 11 05:05:03 UTC 2017] d='doc4design.com'
[Mon Sep 11 05:05:03 UTC 2017] keyauthorization='jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c.KZ04ehApOrSMwkeVbG2UT-klFpwOPf_pDEdqVcHf4XM'
[Mon Sep 11 05:05:03 UTC 2017] uri='https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012'
[Mon Sep 11 05:05:03 UTC 2017] _currentRoot='/home/doc4design/webapps/django_2016/doc4_2016'
[Mon Sep 11 05:05:03 UTC 2017] wellknown_path='/home/doc4design/webapps/django_2016/doc4_2016/.well-known/acme-challenge'
[Mon Sep 11 05:05:03 UTC 2017] writing token:jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c to /home/doc4design/webapps/django_2016/doc4_2016/.well-known/acme-challenge/jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8C$
[Mon Sep 11 05:05:03 UTC 2017] Changing owner/group of .well-known to doc4design:doc4design
[Mon Sep 11 05:05:03 UTC 2017] url='https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012'
[Mon Sep 11 05:05:03 UTC 2017] payload='{"resource": "challenge", "keyAuthorization": "jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c.KZ04ehApOrSMwkeVbG2UT-klFpwOPf_pDEdqVcHf4XM"}'
[Mon Sep 11 05:05:03 UTC 2017] POST
[Mon Sep 11 05:05:03 UTC 2017] url='https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012'
[Mon Sep 11 05:05:03 UTC 2017] _CURL='curl -L --silent --dump-header /home/doc4design/.acme.sh/http.header '
[Mon Sep 11 05:05:03 UTC 2017] _ret='0'
[Mon Sep 11 05:05:03 UTC 2017] code='202'
[Mon Sep 11 05:05:03 UTC 2017] sleep 2 secs to verify
[Mon Sep 11 05:05:05 UTC 2017] checking
[Mon Sep 11 05:05:05 UTC 2017] GET
[Mon Sep 11 05:05:05 UTC 2017] url='https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012'
[Mon Sep 11 05:05:05 UTC 2017] timeout
[Mon Sep 11 05:05:05 UTC 2017] _CURL='curl -L --silent --dump-header /home/doc4design/.acme.sh/http.header '
[Mon Sep 11 05:05:06 UTC 2017] ret='0'
[Mon Sep 11 05:05:06 UTC 2017] doc4design.com:Verify error:Invalid response from http://doc4design.com/.well-known/acme-challenge/jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c:
[Mon Sep 11 05:05:06 UTC 2017] pid
[Mon Sep 11 05:05:06 UTC 2017] No need to restore nginx, skip.
[Mon Sep 11 05:05:06 UTC 2017] _clearupdns
[Mon Sep 11 05:05:06 UTC 2017] skip dns.
[Mon Sep 11 05:05:06 UTC 2017] _on_issue_err
[Mon Sep 11 05:05:06 UTC 2017] Please check log file for more details: /home/doc4design/.acme.sh/acme.sh.log
[Mon Sep 11 05:05:06 UTC 2017] url='https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012'
[Mon Sep 11 05:05:06 UTC 2017] payload='{"resource": "challenge", "keyAuthorization": "jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c.KZ04ehApOrSMwkeVbG2UT-klFpwOPf_pDEdqVcHf4XM"}'
[Mon Sep 11 05:05:06 UTC 2017] POST
[Mon Sep 11 05:05:06 UTC 2017] url='https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012'
[Mon Sep 11 05:05:06 UTC 2017] _CURL='curl -L --silent --dump-header /home/doc4design/.acme.sh/http.header '
[Mon Sep 11 05:05:06 UTC 2017] _ret='0'
[Mon Sep 11 05:05:03 UTC 2017] Changing owner/group of .well-known to doc4design:doc4design
[Mon Sep 11 05:05:03 UTC 2017] url='https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012'
[Mon Sep 11 05:05:03 UTC 2017] payload='{"resource": "challenge", "keyAuthorization": "jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c.KZ04ehApOrSMwkeVbG2UT-klFpwOPf_pDEdqVcHf4XM"}'
[Mon Sep 11 05:05:03 UTC 2017] POST
[Mon Sep 11 05:05:03 UTC 2017] url='https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012'
[Mon Sep 11 05:05:03 UTC 2017] _CURL='curl -L --silent --dump-header /home/doc4design/.acme.sh/http.header '
[Mon Sep 11 05:05:03 UTC 2017] _ret='0'
[Mon Sep 11 05:05:03 UTC 2017] code='202'
[Mon Sep 11 05:05:03 UTC 2017] sleep 2 secs to verify
[Mon Sep 11 05:05:05 UTC 2017] checking
[Mon Sep 11 05:05:05 UTC 2017] GET
[Mon Sep 11 05:05:05 UTC 2017] url='https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012'
[Mon Sep 11 05:05:05 UTC 2017] timeout
[Mon Sep 11 05:05:05 UTC 2017] _CURL='curl -L --silent --dump-header /home/doc4design/.acme.sh/http.header '
[Mon Sep 11 05:05:06 UTC 2017] ret='0'
[Mon Sep 11 05:05:06 UTC 2017] doc4design.com:Verify error:Invalid response from http://doc4design.com/.well-known/acme-challenge/jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c:
[Mon Sep 11 05:05:06 UTC 2017] pid
[Mon Sep 11 05:05:06 UTC 2017] No need to restore nginx, skip.
[Mon Sep 11 05:05:06 UTC 2017] _clearupdns
[Mon Sep 11 05:05:06 UTC 2017] skip dns.
[Mon Sep 11 05:05:06 UTC 2017] _on_issue_err
[Mon Sep 11 05:05:06 UTC 2017] Please check log file for more details: /home/doc4design/.acme.sh/acme.sh.log
[Mon Sep 11 05:05:06 UTC 2017] url='https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012'
[Mon Sep 11 05:05:06 UTC 2017] payload='{"resource": "challenge", "keyAuthorization": "jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c.KZ04ehApOrSMwkeVbG2UT-klFpwOPf_pDEdqVcHf4XM"}'
[Mon Sep 11 05:05:06 UTC 2017] POST
[Mon Sep 11 05:05:06 UTC 2017] url='https://acme-v01.api.letsencrypt.org/acme/challenge/7hHtQgJ6i3H5IplHkU8zq-2n6TVLuUuhN5K9M71nZ8I/1959333012'
[Mon Sep 11 05:05:06 UTC 2017] _CURL='curl -L --silent --dump-header /home/doc4design/.acme.sh/http.header '
[Mon Sep 11 05:05:06 UTC 2017] _ret='0'
[Mon Sep 11 05:05:06 UTC 2017] code='400'
Could someone who is familiar with LetsEncrypt shed some light on why LetsEncrypt can't verify my site, and issue me an SSL certificate ?
The problem is stated on this line:
[Mon Sep 11 05:05:06 UTC 2017] doc4design.com:Verify error:Invalid response from http://doc4design.com/.well-known/acme-challenge/jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c:
The issue is that for whatever reason, external traffic cannot access the file at http://doc4design.com/.well-known/acme-challenge/jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c, which was presumably placed on the filesystem in /home/wwwroot/example.com/.well-known/acme-challenge/jSwY3zdodjpOfh1m6iz1SWNZFFSKnfqdkzj8Cc6Dl2c.
That file needs to be externally accessible at the given URL.
I had this on webfaction.
I see you also have a Django install.
Do you have a separate webapp to serve the static assets?
In my case, I had to place the LetyEncrypt generated file in the same directory where the STATIC assets are located.
I personally settled for this letsencrypt webfaction script last year.
LetsEncrypt utility client for WebFaction hosts
https://github.com/will-in-wi/letsencrypt-webfaction
I have it configured for 2 domains, and last time I checked the LetsEncrypt certificates were renewed automatically.
you can add --debug 2 to get a more detail debug info:
acme.sh --issue -d example.com -w /home/wwwroot/example.com --debug 2
from the log above, I guess it's related to ipv6. your domain has ipv6 AAAA record resolved. Is your website listening at ipv6 ?
Related
I just want to create a VirtualHost with Apache over https. I browsed half the internet but nothing could help me.
I'm using OpenSSL for the certificate and my OS is Windows.
Listen 443
<VirtualHost *:443>
ServerName www.foo.com
ServerAlias foo.com
SSLEngine On
SSLCertificateFile C:/Users/Myzel394/Documents/foo/certificate/aula_com.csr
SSLCertificateKeyFile C:/Users/Myzel394/Documents/foo/certificate/aula_com.key
DocumentRoot C:/Users/Myzel394/Documents/foo
WSGIScriptAlias / C:/Users/Myzel394/Documents/foo/foo/wsgi.py
<Directory C:/Users/Myzel394/Documents/foo/foo>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
My error message:
[Sun May 12 17:26:08.353667 2019] [ssl:warn] [pid 20204:tid 768] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:26:08.396654 2019] [ssl:warn] [pid 20204:tid 768] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:26:08.420646 2019] [mpm_winnt:notice] [pid 20204:tid 768] AH00455: Apache/2.4.33 (Win32) OpenSSL/1.1.0h PHP/7.2.5 configured -- resuming normal operations
[Sun May 12 17:26:08.420646 2019] [mpm_winnt:notice] [pid 20204:tid 768] AH00456: Apache Lounge VC15 Server built: Mar 28 2018 12:12:41
[Sun May 12 17:26:08.420646 2019] [core:notice] [pid 20204:tid 768] AH00094: Command line: 'C:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sun May 12 17:26:08.422646 2019] [mpm_winnt:notice] [pid 20204:tid 768] AH00418: Parent: Created child process 24792
[Sun May 12 17:26:08.943479 2019] [ssl:warn] [pid 24792:tid 732] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:26:08.977486 2019] [ssl:warn] [pid 24792:tid 732] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:26:09.003479 2019] [mpm_winnt:notice] [pid 24792:tid 732] AH00354: Child: Starting 150 worker threads.
[Sun May 12 17:28:47.449329 2019] [mpm_winnt:notice] [pid 20204:tid 768] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Sun May 12 17:28:49.450681 2019] [mpm_winnt:notice] [pid 24792:tid 732] AH00364: Child: All worker threads have exited.
[Sun May 12 17:28:49.470981 2019] [mpm_winnt:notice] [pid 20204:tid 768] AH00430: Parent: Child process 24792 exited successfully.
[Sun May 12 17:44:12.811155 2019] [ssl:warn] [pid 20096:tid 740] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:44:12.848141 2019] [ssl:warn] [pid 20096:tid 740] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:44:12.872133 2019] [mpm_winnt:notice] [pid 20096:tid 740] AH00455: Apache/2.4.33 (Win32) OpenSSL/1.1.0h PHP/7.2.5 configured -- resuming normal operations
[Sun May 12 17:44:12.873133 2019] [mpm_winnt:notice] [pid 20096:tid 740] AH00456: Apache Lounge VC15 Server built: Mar 28 2018 12:12:41
[Sun May 12 17:44:12.873133 2019] [core:notice] [pid 20096:tid 740] AH00094: Command line: 'C:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sun May 12 17:44:12.874133 2019] [mpm_winnt:notice] [pid 20096:tid 740] AH00418: Parent: Created child process 4512
[Sun May 12 17:44:13.311026 2019] [ssl:warn] [pid 4512:tid 664] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:44:13.344016 2019] [ssl:warn] [pid 4512:tid 664] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:44:13.370022 2019] [mpm_winnt:notice] [pid 4512:tid 664] AH00354: Child: Starting 150 worker threads.
[Sun May 12 17:44:14.456350 2019] [mpm_winnt:notice] [pid 20096:tid 740] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Sun May 12 17:44:16.457941 2019] [mpm_winnt:notice] [pid 4512:tid 664] AH00364: Child: All worker threads have exited.
[Sun May 12 17:44:16.475935 2019] [mpm_winnt:notice] [pid 20096:tid 740] AH00430: Parent: Child process 4512 exited successfully.
[Sun May 12 17:44:19.178024 2019] [ssl:warn] [pid 10936:tid 760] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:44:19.214875 2019] [ssl:warn] [pid 10936:tid 760] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:44:19.238868 2019] [mpm_winnt:notice] [pid 10936:tid 760] AH00455: Apache/2.4.33 (Win32) OpenSSL/1.1.0h PHP/7.2.5 configured -- resuming normal operations
[Sun May 12 17:44:19.238868 2019] [mpm_winnt:notice] [pid 10936:tid 760] AH00456: Apache Lounge VC15 Server built: Mar 28 2018 12:12:41
[Sun May 12 17:44:19.238868 2019] [core:notice] [pid 10936:tid 760] AH00094: Command line: 'C:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sun May 12 17:44:19.240867 2019] [mpm_winnt:notice] [pid 10936:tid 760] AH00418: Parent: Created child process 16324
[Sun May 12 17:44:19.779509 2019] [ssl:warn] [pid 16324:tid 660] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:44:19.815498 2019] [ssl:warn] [pid 16324:tid 660] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:44:19.840480 2019] [mpm_winnt:notice] [pid 16324:tid 660] AH00354: Child: Starting 150 worker threads.
[Sun May 12 17:44:20.718806 2019] [mpm_winnt:notice] [pid 10936:tid 760] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Sun May 12 17:44:22.719903 2019] [mpm_winnt:notice] [pid 16324:tid 660] AH00364: Child: All worker threads have exited.
[Sun May 12 17:44:22.738926 2019] [mpm_winnt:notice] [pid 10936:tid 760] AH00430: Parent: Child process 16324 exited successfully.
[Sun May 12 17:44:26.860235 2019] [ssl:warn] [pid 18248:tid 740] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:44:26.897262 2019] [ssl:warn] [pid 18248:tid 740] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:44:26.922251 2019] [mpm_winnt:notice] [pid 18248:tid 740] AH00455: Apache/2.4.33 (Win32) OpenSSL/1.1.0h PHP/7.2.5 configured -- resuming normal operations
[Sun May 12 17:44:26.922251 2019] [mpm_winnt:notice] [pid 18248:tid 740] AH00456: Apache Lounge VC15 Server built: Mar 28 2018 12:12:41
[Sun May 12 17:44:26.922251 2019] [core:notice] [pid 18248:tid 740] AH00094: Command line: 'C:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sun May 12 17:44:26.924250 2019] [mpm_winnt:notice] [pid 18248:tid 740] AH00418: Parent: Created child process 6996
[Sun May 12 17:44:27.370110 2019] [ssl:warn] [pid 6996:tid 716] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:44:27.403127 2019] [ssl:warn] [pid 6996:tid 716] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:44:27.430119 2019] [mpm_winnt:notice] [pid 6996:tid 716] AH00354: Child: Starting 150 worker threads.
[Sun May 12 17:44:29.776464 2019] [mpm_winnt:notice] [pid 18248:tid 740] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Sun May 12 17:44:31.777817 2019] [mpm_winnt:notice] [pid 6996:tid 716] AH00364: Child: All worker threads have exited.
[Sun May 12 17:44:31.796389 2019] [mpm_winnt:notice] [pid 18248:tid 740] AH00430: Parent: Child process 6996 exited successfully.
[Sun May 12 17:44:39.901770 2019] [ssl:warn] [pid 1032:tid 740] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:44:39.902765 2019] [ssl:emerg] [pid 1032:tid 740] AH02572: Failed to configure at least one certificate and key for www.www.foo.com:80
[Sun May 12 17:44:39.902765 2019] [ssl:emerg] [pid 1032:tid 740] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: DH PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Sun May 12 17:44:39.902765 2019] [ssl:emerg] [pid 1032:tid 740] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: EC PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Sun May 12 17:44:39.902765 2019] [ssl:emerg] [pid 1032:tid 740] SSL Library Error: error:140A80B1:SSL routines:SSL_CTX_check_private_key:no certificate assigned
[Sun May 12 17:44:39.902765 2019] [ssl:emerg] [pid 1032:tid 740] AH02312: Fatal error initialising mod_ssl, exiting.
AH00016: Configuration Failed
[Sun May 12 17:44:57.480579 2019] [ssl:warn] [pid 22708:tid 740] AH01909: www.example.com:50000:0 server certificate does NOT include an ID which matches the server name
[Sun May 12 17:44:57.481578 2019] [ssl:emerg] [pid 22708:tid 740] AH02562: Failed to configure certificate www.www.foo.com:443:0 (with chain), check C:/Users/Myzel394/Documents/foo/certificate/aula_com.csr
[Sun May 12 17:44:57.481578 2019] [ssl:emerg] [pid 22708:tid 740] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: TRUSTED CERTIFICATE) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Sun May 12 17:44:57.481578 2019] [ssl:emerg] [pid 22708:tid 740] SSL Library Error: error:140DC009:SSL routines:use_certificate_chain_file:PEM lib
AH00016: Configuration Failed
Hi all i am using Apache mod_wsgi to deploy a python application but i am getting internal server error as:
[Fri Nov 17 17:26:01.285539 2017] [mpm_event:notice] [pid 25751:tid 140495002072960] AH00491: caught SIGTERM, shutting down
[Fri Nov 17 17:26:02.395406 2017] [so:warn] [pid 26122:tid 140693819524992] AH01574: module wsgi_module is already loaded, skipping
[Fri Nov 17 17:26:02.396961 2017] [wsgi:warn] [pid 26123:tid 140693819524992] mod_wsgi: Compiled for Python/2.7.11.
[Fri Nov 17 17:26:02.396983 2017] [wsgi:warn] [pid 26123:tid 140693819524992] mod_wsgi: Runtime using Python/2.7.12.
[Fri Nov 17 17:26:02.397621 2017] [mpm_event:notice] [pid 26123:tid 140693819524992] AH00489: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/2.7.12 configured -- resuming normal operations
[Fri Nov 17 17:26:02.397650 2017] [core:notice] [pid 26123:tid 140693819524992] AH00094: Command line: '/usr/sbin/apache2'
[Fri Nov 17 17:26:28.707573 2017] [wsgi:error] [pid 26126:tid 140693723956992] [client ::1:58008] mod_wsgi (pid=26126): Target WSGI script '/home/rajesh/mymapproxy/config.py' cannot be loaded as Python module.
[Fri Nov 17 17:26:28.707618 2017] [wsgi:error] [pid 26126:tid 140693723956992] [client ::1:58008] mod_wsgi (pid=26126): Exception occurred processing WSGI script '/home/rajesh/mymapproxy/config.py'.
[Fri Nov 17 17:26:28.707636 2017] [wsgi:error] [pid 26126:tid 140693723956992] [client ::1:58008] Traceback (most recent call last):
[Fri Nov 17 17:26:28.707655 2017] [wsgi:error] [pid 26126:tid 140693723956992] [client ::1:58008] File "/home/rajesh/mymapproxy/config.py", line 9, in
[Fri Nov 17 17:26:28.707703 2017] [wsgi:error] [pid 26126:tid 140693723956992] [client ::1:58008] from mapproxy.wsgiapp import make_wsgi_app
[Fri Nov 17 17:26:28.707747 2017] [wsgi:error] [pid 26126:tid 140693723956992] [client ::1:58008] ImportError: No module named mapproxy.wsgiapp
How can i fix this issue
Here is my apache configration: /etc/apche2/site-enabled/000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ServerName localhost
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
WSGIScriptAlias /mapproxy /home/rajesh/workspace/mymapproxy/config.py
WSGIApplicationGroup %{GLOBAL}
<Directory "/home/rajesh/workspace/mymapproxy/">
Order deny,allow
Allow from all
Require all granted
</Directory>
</VirtualHost>
This is my /home/rajesh/workspace/mymapproxy/config.py
from mapproxy.wsgiapp import make_wsgi_app
application = make_wsgi_app(r'/etc/mapproxy.yaml')
Here is my rewrite rule:
RewriteRule ^rest/v(?:[0-9.]+)/((?:[A-Za-z]+)/(?:[A-Za-z]+)(?:/(?:[A-Za-z0-9])+))?\.(json)$ https://localhost/rest/v1/index.php?url=$1&type=$2 [QSA,NC,L]
It’s something of a mouthful so doesn’t help when trying to debug, but it basically allows a URL like this: http://localhost/rest/v1/users/show/12345.json
I’ve tested it in a regex tester online and it passes. But when I add it to my config file, it doesn’t redirect and gives a 404 message as it tries to find the file 1234.json in the show folder of the users folder.
My error log looks like this:
[Tue Oct 27 21:55:16.345721 2015] [mpm_prefork:notice] [pid 4172] AH00169: caught SIGTERM, shutting down
[Tue Oct 27 21:55:21.005180 2015] [suexec:notice] [pid 4318] AH01232: suEXEC mechanism enabled (wrapper: /Applications/XAMPP/xamppfiles/bin/suexec)
[Tue Oct 27 21:55:22.001398 2015] [lbmethod_heartbeat:notice] [pid 4319] AH02282: No slotmem from mod_heartmonitor
[Tue Oct 27 21:55:22.001761 2015] [auth_digest:notice] [pid 4319] AH01757: generating secret for digest authentication ...
[Tue Oct 27 21:55:22.014532 2015] [mpm_prefork:notice] [pid 4319] AH00163: Apache/2.4.10 (Unix) OpenSSL/1.0.1j PHP/5.6.3 mod_perl/2.0.8-dev Perl/v5.16.3 configured -- resuming normal operations
[Tue Oct 27 21:55:22.014627 2015] [core:notice] [pid 4319] AH00094: Command line: '/Applications/XAMPP/xamppfiles/bin/httpd -E /Applications/XAMPP/xamppfiles/logs/error_log -D SSL -D PHP'
[Tue Oct 27 21:55:30.096376 2015] [rewrite:trace3] [pid 4323] mod_rewrite.c(475): [client ::1:50020] ::1 - - [localhost/sid#101019668][rid#10087d4a0/initial] [perdir /Applications/XAMPP/xamppfiles/htdocs/rest/] add path info postfix: /Applications/XAMPP/xamppfiles/htdocs/rest/v1/users -> /Applications/XAMPP/xamppfiles/htdocs/rest/v1/users/show/12345.json
[Tue Oct 27 21:55:30.096499 2015] [rewrite:trace3] [pid 4323] mod_rewrite.c(475): [client ::1:50020] ::1 - - [localhost/sid#101019668][rid#10087d4a0/initial] [perdir /Applications/XAMPP/xamppfiles/htdocs/rest/] strip per-dir prefix: /Applications/XAMPP/xamppfiles/htdocs/rest/v1/users/show/12345.json -> v1/users/show/12345.json
[Tue Oct 27 21:55:30.096507 2015] [rewrite:trace3] [pid 4323] mod_rewrite.c(475): [client ::1:50020] ::1 - - [localhost/sid#101019668][rid#10087d4a0/initial] [perdir /Applications/XAMPP/xamppfiles/htdocs/rest/] applying pattern '^rest/v(?:[0-9.]+)/((?:[A-Za-z]+)/(?:[A-Za-z]+)(?:/(?:[A-Za-z0-9])+))?\\.(json)$' to uri 'v1/users/show/12345.json'
[Tue Oct 27 21:55:30.096521 2015] [rewrite:trace1] [pid 4323] mod_rewrite.c(475): [client ::1:50020] ::1 - - [localhost/sid#101019668][rid#10087d4a0/initial] [perdir /Applications/XAMPP/xamppfiles/htdocs/rest/] pass through /Applications/XAMPP/xamppfiles/htdocs/rest/v1/users
I’m not really sure what’s going on in the error log but it looks like it passes the regex?
Anyone know why it might not be working?
You have this rule in /rest/ directory. Try this rewrite rule instead without rest/ in your rule pattern:
RewriteRule ^v(?:[0-9.]+)/((?:[A-Za-z]+)/(?:[A-Za-z]+)(?:/(?:[A-Za-z0-9])+))?\.json$ v1/index.php?url=$1&type=$2 [QSA,NC,L]
I got the following setup for my django server running on debian:
Apache Config:
<VirtualHost *:8083>
ServerAdmin <mail>
ServerName <ip>
ServerAlias http://<ip>
<Directory /var/www/backend/api/backend/ >
AllowOverride All
Require all granted
Allow from all
</Directory>
WSGIScriptAlias / /var/www/backend/api/backend/apache/django.wsgi
ErrorLog /var/www/backend/api/backend/error.log
</VirtualHost>
Backendfolder with access rights:
drwxrwxr-x 7 www-data www-data 4096 Okt 26 16:23 .
drwxrwxr-x 3 www-data www-data 4096 Sep 29 19:58 ..
drwxrwxr-x 2 www-data www-data 4096 Sep 29 21:47 apache
drwxrwxr-x 9 www-data www-data 4096 Sep 30 16:13 archiv_backend
-rwxrwxr-x 1 www-data www-data 72704 Sep 29 21:56 archiv.db
-rwxrwxrwx 1 www-data www-data 1927 Okt 5 16:59 archiv.log
-rwxrwxr-x 1 www-data www-data 941822 Sep 29 21:26 archiv.log.2015-09-29
-rwxrwxr-x 1 www-data www-data 489231 Sep 30 15:07 archiv.log.2015-09-30
-rwxrwxr-x 1 www-data www-data 3805 Okt 2 23:14 archiv.log.2015-10-02
-rwxrwxr-x 1 www-data www-data 15555 Okt 3 22:40 archiv.log.2015-10-03
drwxrwxr-x 2 www-data www-data 4096 Sep 30 15:56 backend
-rwxrwxr-x 1 www-data www-data 255417 Okt 26 17:17 error.log
drwxrwxr-x 8 www-data www-data 4096 Okt 26 16:29 .git
drwxrwxr-x 3 www-data www-data 4096 Sep 29 19:58 .idea
-rwxrwxr-x 1 www-data www-data 250 Sep 29 19:58 manage.py
-rwxrwxr-x 1 www-data www-data 182 Sep 30 15:25 requirements.txt
-rwxrwxr-x 1 www-data www-data 0 Okt 26 16:29 wsgi.py
In the apache2.conf I added:
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so
<Directory /var/www/backend/api/backend/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
When I send a request to the server on port 8083 I always see the following error in the error.log:
[Mon Oct 26 16:23:28.171069 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] mod_wsgi (pid=13469): Target WSGI script '/var/www/backend/api/backend/apache/django.wsgi' cannot be loaded as Python module.
[Mon Oct 26 16:23:28.171113 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] mod_wsgi (pid=13469): Exception occurred processing WSGI script '/var/www/backend/api/backend/apache/django.wsgi'.
[Mon Oct 26 16:23:28.171142 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] Traceback (most recent call last):
[Mon Oct 26 16:23:28.171169 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] File "/var/www/backend/api/backend/apache/django.wsgi", line 16, in <module>
[Mon Oct 26 16:23:28.171208 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] application = get_wsgi_application()
[Mon Oct 26 16:23:28.171278 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 14, in get_wsgi_application
[Mon Oct 26 16:23:28.171381 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] django.setup()
[Mon Oct 26 16:23:28.171418 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 17, in setup
[Mon Oct 26 16:23:28.171443 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Mon Oct 26 16:23:28.171478 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] File "/usr/local/lib/python2.7/dist-packages/django/utils/log.py", line 86, in configure_logging
[Mon Oct 26 16:23:28.171513 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] logging_config_func(logging_settings)
[Mon Oct 26 16:23:28.171568 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] File "/usr/lib/python2.7/logging/config.py", line 794, in dictConfig
[Mon Oct 26 16:23:28.171591 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] dictConfigClass(config).configure()
[Mon Oct 26 16:23:28.171601 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] File "/usr/lib/python2.7/logging/config.py", line 576, in configure
[Mon Oct 26 16:23:28.171615 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] '%r: %s' % (name, e))
[Mon Oct 26 16:23:28.171654 2015] [wsgi:error] [pid 13469:tid 139695967143680] [client <ip>:56892] ValueError: Unable to configure handler 'logfile': [Errno 13] Permission denied: '/archiv.log'
[Mon Oct 26 16:23:28.315954 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] mod_wsgi (pid=13469): Target WSGI script '/var/www/backend/api/backend/apache/django.wsgi' cannot be loaded as Python module., referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.315978 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] mod_wsgi (pid=13469): Exception occurred processing WSGI script '/var/www/backend/api/backend/apache/django.wsgi'., referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.315995 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] Traceback (most recent call last):, referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.316013 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] File "/var/www/backend/api/backend/apache/django.wsgi", line 16, in <module>, referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.316034 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] application = get_wsgi_application(), referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.316124 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 14, in get_wsgi_application, referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.316192 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] django.setup(), referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.316207 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 17, in setup, referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.316300 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING), referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.316336 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] File "/usr/local/lib/python2.7/dist-packages/django/utils/log.py", line 86, in configure_logging, referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.316357 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] logging_config_func(logging_settings), referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.316367 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] File "/usr/lib/python2.7/logging/config.py", line 794, in dictConfig, referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.316429 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] dictConfigClass(config).configure(), referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.316485 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] File "/usr/lib/python2.7/logging/config.py", line 576, in configure, referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.316523 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] '%r: %s' % (name, e)), referer: http://<ip>:8083/
[Mon Oct 26 16:23:28.316548 2015] [wsgi:error] [pid 13469:tid 139695958750976] [client <ip>:56894] ValueError: Unable to configure handler 'logfile': [Errno 13] Permission denied: '/archiv.log', referer: http://<ip>:8083/
Here is my WSGI file:
import os
import sys
path = '/var/www/backend/api/backend/'
if path not in sys.path:
sys.path.insert(0, '/var/www/backend/api/backend/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'backend.settings'
os.environ['ARCHIV_ENVIRONMENT'] = 'production'
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
One solution I found was to chown or chgrp the folder or the log file in the /var/www/ directory. As you can see, all files there are now owned and for grp www-data which should be used by wsgi.
But I still get the error. I didn't forget to restart apache.
According to the error messages, it's trying to write to /archiv.log. Look closely at the logging information in settings.py to see why it's trying to write to the root directory.
I have been trying to deploy my Django application on ubuntu 14.04 with the installed packages which are:
django 1.4.15
apache 2.4
python 2.7
mod_wsgi 3.4 (there is one compiled as mod_wsig.so-2.7 which is the one I use)
on my apache config I have this fields:
# Modules
LoadModule mpm_worker_module /usr/lib/apache2/modules/mod_mpm_worker.so
LoadModule mime_module /usr/lib/apache2/modules/mod_mime.so
LoadModule alias_module /usr/lib/apache2/modules/mod_alias.so
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so-2.7
LoadModule setenvif_module /usr/lib/apache2/modules/mod_setenvif.so
LoadModule authn_core_module /usr/lib/apache2/modules/mod_authn_core.so
LoadModule authz_core_module /usr/lib/apache2/modules/mod_authz_core.so
...
<Directory />
Options FollowSymLinks
AllowOverride None
AuthType none
Require all granted
</Directory>
...
# And finally the app config.
WSGIPythonHome /home/web/.virtualenvs/web
WSGIPythonPath /PATH/TO/MYSITE:/home/web/.virtualenvs/web/lib/python2.7/site-packages
WSGIScriptAlias / "/PATH/TO/wsgi.py"
Everything seems to be fine until I try to import one of the local modules in my system. By this I mean, the wsgi.py script runs no problem and then the django settings.py start running, in the settings I have this code:
from MYSITE.environments.prod_settings import *
environments is a module with it's own __init__.py file and all. but when it reaches that line it can't import.
The other part is that the site runs perfectly when I run ./manage.py runserver and the info in the sys.path is just the same!
I am just out of ideas on why apache wsgi will not let me import that python module.
Here is the latest logs:
[Fri Nov 28 18:07:06.222374 2014] [core:notice] [pid 3639:tid 140258688976768] AH00094: Command line: '/usr/sbin/apache2'
[Fri Nov 28 18:07:09.322057 2014] [:error] [pid 3642:tid 140258619721472] /home/web/.virtualenvs/web <--- printed the sys.prefix
[Fri Nov 28 18:07:09.673877 2014] [:error] [pid 3642:tid 140258619721472] 2014-11-28 18:07:09,670 (3642/MainThread) newrelic ERROR - Falling back to stderr logging as unable to create log file '/var/log/newrelic/newrelic-python-agent.log'.
[Fri Nov 28 18:07:09.673930 2014] [:error] [pid 3642:tid 140258619721472] Traceback (most recent call last):
[Fri Nov 28 18:07:09.673941 2014] [:error] [pid 3642:tid 140258619721472] File "/home/web/.virtualenvs/web/local/lib/python2.7/site-packages/newrelic-2.28.0.26/newrelic/common/log_file.py", line 79, in initialize_logging
[Fri Nov 28 18:07:09.673950 2014] [:error] [pid 3642:tid 140258619721472] _initialize_file_logging(log_file, log_level)
[Fri Nov 28 18:07:09.673959 2014] [:error] [pid 3642:tid 140258619721472] File "/home/web/.virtualenvs/web/local/lib/python2.7/site-packages/newrelic-2.28.0.26/newrelic/common/log_file.py", line 51, in _initialize_file_logging
[Fri Nov 28 18:07:09.673969 2014] [:error] [pid 3642:tid 140258619721472] handler = logging.FileHandler(log_file)
[Fri Nov 28 18:07:09.673977 2014] [:error] [pid 3642:tid 140258619721472] File "/usr/lib/python2.7/logging/__init__.py", line 903, in __init__
[Fri Nov 28 18:07:09.673985 2014] [:error] [pid 3642:tid 140258619721472] StreamHandler.__init__(self, self._open())
[Fri Nov 28 18:07:09.673993 2014] [:error] [pid 3642:tid 140258619721472] File "/usr/lib/python2.7/logging/__init__.py", line 928, in _open
[Fri Nov 28 18:07:09.674001 2014] [:error] [pid 3642:tid 140258619721472] stream = open(self.baseFilename, self.mode)
[Fri Nov 28 18:07:09.674009 2014] [:error] [pid 3642:tid 140258619721472] IOError: [Errno 13] Permission denied: '/var/log/newrelic/newrelic-python-agent.log'
[Fri Nov 28 18:07:09.985905 2014] [:error] [pid 3642:tid 140258619721472] No module named wizzytest2 <---- My module name
After the module error the logs errors are about problems with database connections in general. This happens because in the wizzytest2 module I have settings overrides so that is expected.
[Sat Nov 29 21:37:44.923879 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web' <-- python home
[Sat Nov 29 21:37:44.924177 2014] [:error] [pid 6097:tid 140297485195008] ['/home/web/.virtualenvs/web/lib/python2.7/site-packages',
[Sat Nov 29 21:37:44.924230 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/MYSITE/mysite',
[Sat Nov 29 21:37:44.924256 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/src/python-itunes',
[Sat Nov 29 21:37:44.924287 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/lib/python2.7',
[Sat Nov 29 21:37:44.924312 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/lib/python2.7/plat-x86_64-linux-gnu',
[Sat Nov 29 21:37:44.924342 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/lib/python2.7/lib-tk',
[Sat Nov 29 21:37:44.924366 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/lib/python2.7/lib-old',
[Sat Nov 29 21:37:44.924395 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/lib/python2.7/lib-dynload',
[Sat Nov 29 21:37:44.924419 2014] [:error] [pid 6097:tid 140297485195008] '/usr/lib/python2.7',
[Sat Nov 29 21:37:44.924449 2014] [:error] [pid 6097:tid 140297485195008] '/usr/lib/python2.7/plat-x86_64-linux-gnu',
[Sat Nov 29 21:37:44.924483 2014] [:error] [pid 6097:tid 140297485195008] '/usr/lib/python2.7/lib-tk',
[Sat Nov 29 21:37:44.924557 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/local/lib/python2.7/site-packages',
[Sat Nov 29 21:37:44.924583 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/local/lib/python2.7/site-packages/newrelic-2.28.0.26',
[Sat Nov 29 21:37:44.924615 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/lib/python2.7/site-packages',
[Sat Nov 29 21:37:44.924641 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/lib/python2.7/site-packages/newrelic-2.28.0.26',
[Sat Nov 29 21:37:44.924663 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/MYSITE',
[Sat Nov 29 21:37:44.924695 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/MYSITE/mysite']
[Sat Nov 29 21:37:45.474168 2014] [:error] [pid 6097:tid 140297485195008] No module named wizzytest2
Just added the python path too so it's easier to debug. I also fixed the newrelic issue but that doesn't makes any difference on the settings file wizzytest2 been found or not.
Now with your logs I think the trouble is evident:
IOError: [Errno 13] Permission denied: '/var/log/newrelic/newrelic-python-agent.log/'
The user which launches your application doesn't have the right to write in '/var/log/newrelic/newrelic-python-agent.log'.
Maybe chmod -R +w '/var/log/newrelic/' can help you. But in fact, you should place the user which launch your app in an appropriate group which can write logs.
Note:
You should use uWSGI or Gunicorn for control you app and only use apache as frontend.
At the end this was an issue with permissions on the overriding settings file I wanted to import, at the end I just needed to do a chown web:web to the file and a chmod.