我最近在Apache服务器Fedora 36上本地部署了Django项目。通过IP访问站点时一切正常。无法通过主机名访问它的问题。我收到了“Bad Request(400)”错误。
这是我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>
和我的主机文件
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.109 calljournal.local
1条答案
按热度按时间rqqzpn5f1#
您需要在
ALLOWED_HOSTS
设置中输入主机名。