Conflict between php and django with apache sites-available
I have a VPS ubuntu 16, in which I have a web page in Wordpress and one in Django, I decided to update my server using the following command: sudo apt-get update && sudo apt-get upgrade
After the update the website in Django stopped working and presents the following message:
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at support@javiercb.com to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. Apache / 2.4.37 (Ubuntu) Server at phraster.com Port 80
And in the log file it presents the following message:
[Tue Jan 29 22: 41: 55.852599 2019] [wsgi: error] [pid 11606] [client 181.199.43.182:53977] Truncated or oversized response headers received from daemon process 'phraster': /var/www/phraster/javiercb/apache.conf/web.wsgi, referer: http://phraster.com/
I attach the two files of apache.conf
Due to this problem, I bought another VPS and unfortunately the problem you got.
Apache
<virtualhost *:80="">
ServerName phraster.com
ServerAlias www.phraster.com
serverAdmin soporte@javiercb.com</virtualhost>
ServerSignature On
ErrorLog /var/log/apache2/phraster.com_error.log
LogLevel warn
CustomLog /var/log/apache2/phraster.com_access.log combined
DocumentRoot /var/www/phraster/javiercb
<Directory /var/www/phraster/javiercb>
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess phraster python-path=/var/www/phraster/javiercb:/var/www/virtualenv/env_1.11/lib/python2.7/site-packages
WSGIProcessGroup phraster
WSGIScriptAlias / /var/www/phraster/javiercb/apache.conf/web.wsgi
<Directory /var/www/phraster/javiercb/apache.conf>
<Files web.wsgi.py>
Order deny,allow
Require all granted
</Files>
</Directory>
<Directory /var/www/phraster/javiercb/media>
Order deny,allow
Allow from all
</Directory>
<Directory /var/www/phraster/javiercb/static>
Order deny,allow
Allow from all
</Directory>
Alias /static/ "/var/www/phraster/javiercb/static/"
Alias /media/ "/var/www/phraster/javiercb/media/"
<Directory "/var/www/virtualenv/env_1.11/lib/python2.7/site-packages/django/contrib/admin/static/admin">
Order allow,deny
Options Indexes
Allow from all
IndexOptions FancyIndexing
</Directory>
web.wsgi
import os
import sys
path = '/var/www/phraster/javiercb/javiercb'
if path not in sys.path:
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'javiercb.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Please, someone to give me an idea or to have solved this problem. I thank you for your help.
Greetings Javier.
1 Reply
Hey there,
This is likely due to a Python C extension module, which are known to cause timeouts when used under mod_wsgi. The default maximum header size for what is returned from mod_wsgi daemon mode, that is header name and value, may be to low for your system.
You can override this by using the 'header-buffer-size' option to WSGIDaemonProcess after consulting the documentation:
header-buffer-size=nnn
Defines the maximum size that a response header/value can be that is returned from a WSGI application. The default size is 32768 bytes. This might need to be overridden where excessively large response headers are returned, such as in custom authentication challenge schemes which use the WWW-Authenticate header.
It is also possible that this is a memory related issue. We recommend ensuring that your disks have all of the storage available to your LInode properly allocated in the Advanced tab of your Linode's dashboard from the Cloud Manager. You can review your internal system memory with the following:
$ free -m
We hope that helps!