我正在尝试在Apache / 2.4.9(安装了Python 2.7.4)上使用virtualenv运行Django 1.6项目。 我已设置Debug = True以避免主机冲突。我一直得到400个错误请求。
问题仅出现在我的本地服务器上(Ubuntu 14.04.1 LTS(GNU / Linux 3.11.0-19-generic x86_64))。我在其他服务器上部署了项目(Ubuntu 14.04 LTS(GNU / Linux 3.13.0-27-generic x86_64)| Apache / 2.4.7),一切正常。
低于vhost配置。
<VirtualHost 127.0.0.1:80>
ServerName myproject_django.dev
DocumentRoot /var/www/myproject_django
RequestHeader set X-Request-Start "%t"
WSGIScriptAlias / /var/www/myproject_django/myproject/myproject/wsgi.py
WSGIDaemonProcess myproject_django user=user group=user processes=5 threads=25 python-path=/var/www/myproject_django/myproject:/var/www/myproject_django/myproject/venv/lib/python2.7/site-packages
WSGIProcessGroup myproject_django
SetEnv SERVER_TYPE REGULAR
WSGIPassAuthorization On
<Directory /var/www/myproject_django>
#Options Indexes FollowSymLinks MultiViews
#AllowOverride None
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
Alias /static /var/www/myproject_django/myproject/myproject/static/
ErrorLog /var/log/apache2/myproject-error.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
#LogLevel warn
LogLevel error
CustomLog /var/log/apache2/myproject-access.log combined
如果您需要更多的信息,请告诉我。
编辑:
是否可以连接到haproxy或DNS服务器?
EDIT2(问题已解决): 问题在于ServerName(Django问题)中的“_”字符