samedi 17 octobre 2020

Why does my apache2 server temporarily crash when I submit forms on my django website?

I have made a website using Django. It has login functionality and allows you two create, update and like posts. It works correctly on the development server running locally but when I set it up on apache2 almost all the functionality works. The parts that break are that whenever I create, update or like a post the page does not load and the apache server shuts down for a while. When I check the apache logs it gives an empty 408 error. I have tried making both the timeouts in the apache config larger and this has not helped.

I'm sorry if the answer to this is on here as I couldn't find it despite searching if you know of one please link me. If any extra info is required please ask. Thank you!

Edit 1: setup

/etc/apache2/sites-available/resume_site.conf

RewriteEngine on
RewriteCond %{http_host} !^www.andyflynnsmiles.com [nc]
RewriteRule ^(.*)$ http://www.andyflynnsmiles.com/$1 [r=301,nc]

RewriteCond %{SERVER_NAME} =www.andyflynnsmiles.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

/etc/apache2/sites-available/resume_site-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.

        ServerName www.andyflynnsmiles.com
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf

        Alias /static /home/andysmiles/resume_site/platformer_project/static
        <Directory /home/andysmiles/resume_site/platformer_project/static>
                Require all granted
        </Directory>

        Alias /media /home/andysmiles/resume_site/media
        <Directory /home/andysmiles/resume_site/media>
                Require all granted
        </Directory>

        <Directory /home/andysmiles/resume_site/platformer_project>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>

        <Directory /home/andysmiles/resume_site>
                Require all granted
        </Directory>

        WSGIScriptAlias / /home/andysmiles/resume_site/resume_site/wsgi.py
        WSGIDaemonProcess resume_site python-path=/home/andysmiles/resume_site python-home=/home/andysmiles/resume_site/venv
        WSGIProcessGroup resume_site



Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias andyflynnsmiles.com
SSLCertificateFile /etc/letsencrypt/live/andyflynnsmiles.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/andyflynnsmiles.com/privkey.pem
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
</IfModule>

Aucun commentaire:

Enregistrer un commentaire