Apache Error during SSL Handshake with remote server - amazon-web-services

I have apache listening on 443, and web app nodejs listening on 6969 on EC2 linux server.
I have ssl.conf file
<VirtualHost _default_:443>
SSLEngine On
SSLProxyEngine On
ProxyRequests Off
ProxyPreserveHost On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
ServerAdmin ***#gmail.com
DocumentRoot /var/www/html/***
ServerName ***
SSLCertificateFile "***/certificate.crt"
SSLCertificateChainFile "***/ca_bundle.crt"
SSLCertificateKeyFile "***/private.key"
ProxyPass / https://127.0.0.1:6969/
ProxyPassReverse / https://127.0.0.1:6969/
<Directory "/var/www/html/***">
Order deny,allow
Allow from all
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
and file httpd/error_log
[Sun Jul 12 18:56:27.176297 2020] [proxy:error] [pid 32374:tid 140253401167616] (20014)Internal error (specific information not available): [client 117.6.62.***:32539] AH01084: pass request body failed to 127.0.0.1:6969 (127.0.0.1)
[Sun Jul 12 18:56:27.176334 2020] [proxy:error] [pid 32374:tid 140253401167616] [client 117.6.62.***:32539] AH00898: Error during SSL Handshake with remote server returned by /
[Sun Jul 12 18:56:27.176339 2020] [proxy_http:error] [pid 32374:tid 140253401167616] [client 117.6.62.***:32539] AH01097: pass request body failed to 127.0.0.1:6969 (127.0.0.1) from 117.6.62.*** ()
[Sun Jul 12 18:56:34.161784 2020] [proxy:error] [pid 32374:tid 140253401167616] (20014)Internal error (specific information not available): [client 117.6.62.***:32542] AH01084: pass request body failed to 127.0.0.1:6969 (127.0.0.1)
[Sun Jul 12 18:56:34.161831 2020] [proxy:error] [pid 32374:tid 140253401167616] [client 117.6.62.***:32542] AH00898: Error during SSL Handshake with remote server returned by /
[Sun Jul 12 18:56:34.161836 2020] [proxy_http:error] [pid 32374:tid 140253401167616] [client 117.6.62.***:32542] AH01097: pass request body failed to 127.0.0.1:6969 (127.0.0.1) from 117.6.62.*** ()
[Sun Jul 12 18:56:47.451390 2020] [mpm_event:notice] [pid 32156:tid 140253690120384] AH00492: caught SIGWINCH, shutting down gracefully
[Sun Jul 12 18:56:48.524967 2020] [suexec:notice] [pid 32494:tid 140512587598016] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sun Jul 12 18:56:48.549325 2020] [lbmethod_heartbeat:notice] [pid 32494:tid 140512587598016] AH02282: No slotmem from mod_heartmonitor
[Sun Jul 12 18:56:48.552155 2020] [mpm_event:notice] [pid 32494:tid 140512587598016] AH00489: Apache/2.4.43 () OpenSSL/1.0.2k-fips configured -- resuming normal operations
[Sun Jul 12 18:56:48.552179 2020] [core:notice] [pid 32494:tid 140512587598016] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
Can anyone suggest what I am doing wrong?

This was as the result of trying to communicate using HTTPS to the internal node application.
The application was running on HTTPS, updating to HTTP internally resolved this.

Related

Django Apache - Virtualhost with HTTPS not starting

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

how to solve mod_wsgi python conflict error

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')

mod_wsgi cannot be loaded as Python module

I'm trying to access a Django application using apache and I'm getting Internal Server Error. I've opened the logs to see what is going on and I found this:
[Thu Jun 23 03:10:03 2016] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Jun 23 03:10:03 2016] [notice] Digest: generating secret for digest authentication ...
[Thu Jun 23 03:10:03 2016] [notice] Digest: done
[Thu Jun 23 03:10:03 2016] [notice] Apache/2.2.15 (Unix) DAV/2 mod_wsgi/3.2 Python/2.6.6 configured -- resuming normal operations
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] mod_wsgi (pid=5612): Target WSGI script '/home/TaskManagement/teamwork/wsgi.py' cannot be loaded as Python module.
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] mod_wsgi (pid=5612): Exception occurred processing WSGI script '/home/TaskManagement/teamwork/wsgi.py'.
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] Traceback (most recent call last):
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] File "/home/TaskManagement/teamwork/wsgi.py", line 15, in <module>
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] from django.core.wsgi import get_wsgi_application
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] File "/home/py3venv/lib/python3.4/site-packages/django/__init__.py", line 1, in <module>
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] from django.utils.version import get_version
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] File "/home/py3venv/lib/python3.4/site-packages/django/utils/version.py", line 7, in <module>
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] from django.utils.lru_cache import lru_cache
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] File "/home/py3venv/lib/python3.4/site-packages/django/utils/lru_cache.py", line 28
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] fasttypes = {int, str, frozenset, type(None)},
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] ^
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] SyntaxError: invalid syntax
I'm using python 3.4, Django 1.9, apache 2.2.
and here is my apache configuration:
WSGISocketPrefix /var/run/wsgi
WSGIScriptAlias / /home/TaskManagement/teamwork/wsgi.py process-group=hrm.jodod.info
WSGIDaemonProcess hrm.jodod.info python-path=/home/TaskManagement:/home/py3venv/lib/python3.4/site-packages
WSGIProcessGroup hrm.jodod.info
Alias /robots.txt /home/TaskManagement/robots.txt
Alias /favicon.ico /home/TaskManagement/favicon.ico
Alias /static/ /home/TaskManagement/static/
<Directory /path/to/mysite.com/static>
Order deny,allow
Allow from all
</Directory>
<Directory /home/TaskManagement/teamwork>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
and here is my wsgi.py file:
import os
import sys
sys.path.append('/home/TaskManagement')
sys.path.append('/home/TaskManagement/teamwork')
from django.core.wsgi import get_wsgi_application
os.environ["DJANGO_SETTINGS_MODULE"] = "{{ project_name }}.settings"
application = get_wsgi_application()
Can anybody figure out what am I doing wrong?
Python/2.6.6 configured -- resuming normal operations
Looks like your mod_wsgi is compiled against Python 2.6.6 and you're trying to run Python3 code with it. The Set syntax you are seeing in the error appeared in Py3. Recompile mod_wsgi and try again.
Your wsgi.py line 9 has to be
os.environ["DJANGO_SETTINGS_MODULE"] = "teamwork.settings"
if the directory it's stored is called teamwork (your project's name)
also in your manage.py it has to be "teamwork.settings"

RewriteRule not redirecting to specified file

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]

Django + Apache - wsgi trouble

I've been working with Django locally and now I'm trying to push some code to a production Apache environment on an Ubuntu server I have running (http://www.youtube.com/watch?v=hBMVVruB9Vs).
However, I just get a list of files in the directory and nothing else. First of all I ensured that Python was install by running the command Python at the terminal.
I've installed apaache and mod wsgi with the following commands:
sudo apt-get install apache2
sudo apt-get install libapache2-mod-wsgi
And I've tested to see that its enabled.
Here is my wsgi file firstweb.wsgi which is located in root:
import os
import sys
sys.path.append('/var/www/firstweb')
os.environ['DJANGO_SETTINGS_MODULE'] = 'firstweb.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Here is my firstweb.conf file:
<VirtualHost *:80>
WSGIScriptAlias / /firstweb.wsgi
Alias /static /var/www/firstweb/static
<Directory /var/www/firstweb/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and my Django project is located in: /var/www/firstweb/
I honestly can't work out what is wrong here, within the video it is running fine! :(
Edit, here is error log:
[Sat Feb 16 16:19:31 2013] [notice] Apache/2.2.22 (Ubuntu) configured -- resuming normal operations
[Sat Feb 16 16:20:46 2013] [notice] caught SIGTERM, shutting down
[Sat Feb 16 16:20:47 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Feb 16 16:20:47 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Feb 16 16:20:47 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sat Feb 16 16:37:05 2013] [notice] caught SIGTERM, shutting down
[Sat Feb 16 16:37:06 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Feb 16 16:37:06 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Feb 16 16:37:06 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sat Feb 16 16:37:17 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:37:20 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:37:24 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:37:24 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:37:24 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:37:25 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:37:25 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:37:26 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:38:01 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:39:19 2013] [notice] caught SIGTERM, shutting down
[Sat Feb 16 16:39:20 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Feb 16 16:39:20 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Feb 16 16:39:20 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sat Feb 16 16:39:24 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:39:42 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:48:00 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:48:02 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:49:51 2013] [notice] caught SIGTERM, shutting down
[Sat Feb 16 16:49:52 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Feb 16 16:49:52 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Feb 16 16:49:52 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sat Feb 16 16:49:55 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:49:56 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:49:58 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:53:21 2013] [notice] caught SIGTERM, shutting down
[Sat Feb 16 16:53:22 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Feb 16 16:53:22 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Feb 16 16:53:22 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sat Feb 16 16:55:34 2013] [notice] caught SIGTERM, shutting down
[Sat Feb 16 16:55:35 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Feb 16 16:55:35 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Feb 16 16:55:35 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sat Feb 16 17:00:07 2013] [notice] caught SIGTERM, shutting down
[Sat Feb 16 17:00:08 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Feb 16 17:00:08 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Feb 16 17:00:08 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
Try configuring your virtualhost like so:
<Directory /var/www/firstweb/static>
Order allow,deny
Option Indexes
Allow from all
</Directory>
WSGIScriptAlias / /full-system-path-to/firstweb/wsgi.py
If that doesn't work - just make a change to the Directory tag and add static to the end like I have above - I think by not adding static, it's displaying the files in the directory
Configuring your virtualhost like:
<VirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com
DocumentRoot /var/production/myApp
<Directory />
Order Deny,Allow
Deny from all
Options None
AllowOverride None
</Directory>
<Directory /var/production/myApp>
Options None
AllowOverride None
Order allow,deny
allow from all
</Directory>
WSGIDaemonProcess mysite.com python-path=/var/production/myApp:/var/production/myApp/venv/lib/python2.7/site-packages
WSGIProcessGroup misite.com
WSGIScriptAlias / /var/production/myApp/myApp/wsgi.py
Alias /static /var/production/myApp/static
<Directory /var/production/myApp/static>
Options None
AllowOverride None
Order Allow,Deny
Allow from all
</Directory>
Replaces "/var/production/myApp" to your app path
If you need more help look at this tutorial
Question 1: Did you enable the wsgi mod?
sudo a2enmod mod-wsgi
Question 2: Where are your AddHandler statements?
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews ExecCGI
AddHandler cgi-script .cgi
AddHandler wsgi-script .wsgi
AllowOverride None
Order allow,deny
allow from all
</Directory>
I don't think apache knows how to associate .wsgi files to the wsgi application.