简体   繁体   中英

Django Apache and name-based VirtualHost

I have recently locally deployed Django project on Apache server Fedora 36. Everything work good when accessing site by ip. The issue that could not access it by hostname. I am getting "Bad Request (400)" error.

here my httpd.conf

<VirtualHost *:80>
        ServerName calljournal.local
        alias /static /var/www/django_project/call_journal/static
        <Directory /var/www/django_project/call_journal/static>
                Require all granted
        </Directory>
        <Directory /var/www/django_project/call_journal>
                Require all granted
        </Directory>
        WSGIDaemonProcess calljournal.local python-path=/var/www/django_project/virt/lib/python3.8/site-packages
        WSGIProcessGroup calljournal.local
        WSGIScriptAlias / /var/www/django_project/call_journal/call_journal/wsgi.py
        redirect / https://192.168.1.109
</VirtualHost>

and my hosts file

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.109 calljournal.local

You need to enter the hostname in ALLOWED_HOSTS settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM