我收到404錯誤試圖訪問在生產環節上EC2我Django應用程序靜態文件的時候,雖然它在同Bitnami堆在VBOX上演絕精細。我的Alias
條目httpd.conf
正常工作robots.txt
和favicon.ico
- 我可以正確訪問它們。然而,我不能使用它的Alias
條目(即在所有頁面上)訪問/static
中特定的任何內容。404錯誤與靜態文件通過Django的/阿帕奇(Bitnami)擔任
我在我的apache日誌中沒有發現有關被服務器配置/ etc阻止的錯誤,並且我的static
文件夾的權限被(臨時)設置爲777,並沒有幫助。我究竟做錯了什麼?
我STATIC_ROOT是/opt/bitnami/apps/django/django_projects/data_dashboard/project/static
我httpd.conf
文件看起來像這樣:
<Directory /opt/bitnami/apps/django/django_projects/data_dashboard/project/project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias//opt/bitnami/apps/django/django_projects/data_dashboard/project/project/wsgi.py
<Directory "/opt/bitnami/apps/django/django_projects/data_dashboard/project/static">
Require all granted
</Directory>
Alias /static /opt/bitnami/apps/django/django_projects/data_dashboard/project/static
Alias /robots.txt /opt/bitnami/apps/django/django_projects/data_dashboard/project/static/robots.txt
Alias /favicon.ico /opt/bitnami/apps/django/django_projects/data_dashboard/project/static/favicon.ico
我httpd-vhosts.conf
:
<VirtualHost *:80>
ServerName ec2-xx-xx-xxx-xx.eu-west-1.compute.amazonaws.com
Include "/opt/bitnami/apps/django/django_projects/data_dashboard/project/conf/httpd-app.conf"
</VirtualHost>
<VirtualHost *:443>
ServerName ec2-xx-xx-xxx-xx.eu-west-1.compute.amazonaws.com
SSLEngine on
SSLCertificateFile "/opt/bitnami/apps/django/django_projects/data_dashboard/project/conf/certs/server.crt"
SSLCertificateKeyFile "/opt/bitnami/apps/django/django_projects/data_dashboard/project/conf/certs/server.key"
Include "/opt/bitnami/apps/django/django_projects/data_dashboard/project/conf/httpd-app.conf"
我http-app.conf
:
<IfDefine !IS_DJANGOSTACK_LOADED>
Define IS_DJANGOSTACK_LOADED
WSGIDaemonProcess wsgi-djangostack processes=2 threads=15 display-name=%{GROUP}
</IfDefine>
<Directory "/opt/bitnami/apps/django/django_projects/data_dashboard/project/project">
Options +MultiViews
AllowOverride All
<IfVersion <2.3>
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
WSGIProcessGroup wsgi-djangostack
WSGIApplicationGroup %{GLOBAL}
<IfVersion <2.3>
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
<Directory "/opt/bitnami/python/lib/python2.7/site-packages/django">
Options +MultiViews
AllowOverride All
<IfVersion <2.3>
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
感謝您的支持。不幸的是我的堆棧使用2.4.12。無論如何我已經嘗試了這個清晰度,同樣的問題仍然存在。 – samg86