在 Django 网站 Apache 的 Bitnami @ google 云中加载静态文件时出现 403 错误
403 error loading static files in Bitnami @ google cloud for Django website Apache
把我从 Apache 的疯狂中拯救出来。
我使用 Bitnami (Apache) 在 google 云中部署了一个 Django 站点,模板加载正常。但是静态文件 return:
Failed to load resource: the server responded with a status of 403 (Forbidden)
httpd-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/project/project">
Options +MultiViews
AllowOverride All
<IfVersion >= 2.3>
Require all granted
</IfVersion>
WSGIProcessGroup wsgi-djangostack
WSGIApplicationGroup %{GLOBAL}
</Directory>
Alias /static/ "/opt/bitnami/apps/django/django_projects/project/static"
<Directory /opt/bitnami/apps/django/django_projects/project/static>
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
WSGIScriptAlias /project '/opt/bitnami/apps/django/django_projects/project/project/wsgi.py'
收集到的静态数据位于 /opt/bitnami/apps/django/django_projects/project/static
我已经尝试了我找到的所有解决方案,首先我添加了
<Directory /opt/bitnami/apps/django/django_projects/project/static>
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
在 httpd.conf 在 apache 中...没有工作
然后我通过以下方式设置对项目目录的权限:
sudo chmod 775 /opt/bitnami/apps/django/django-projets/project
sudo chown -R bitnami:daemon /opt/bitnami/apps/django/django-projets/project
也没用。接下来是几个基本上与这两个相似的几个。
谢谢
我通过向网站的整个目录添加 777 权限解决了这个问题。
chmod -R 777 目录名
把我从 Apache 的疯狂中拯救出来。 我使用 Bitnami (Apache) 在 google 云中部署了一个 Django 站点,模板加载正常。但是静态文件 return:
Failed to load resource: the server responded with a status of 403 (Forbidden)
httpd-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/project/project">
Options +MultiViews
AllowOverride All
<IfVersion >= 2.3>
Require all granted
</IfVersion>
WSGIProcessGroup wsgi-djangostack
WSGIApplicationGroup %{GLOBAL}
</Directory>
Alias /static/ "/opt/bitnami/apps/django/django_projects/project/static"
<Directory /opt/bitnami/apps/django/django_projects/project/static>
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
WSGIScriptAlias /project '/opt/bitnami/apps/django/django_projects/project/project/wsgi.py'
收集到的静态数据位于 /opt/bitnami/apps/django/django_projects/project/static
我已经尝试了我找到的所有解决方案,首先我添加了
<Directory /opt/bitnami/apps/django/django_projects/project/static>
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
在 httpd.conf 在 apache 中...没有工作
然后我通过以下方式设置对项目目录的权限:
sudo chmod 775 /opt/bitnami/apps/django/django-projets/project
sudo chown -R bitnami:daemon /opt/bitnami/apps/django/django-projets/project
也没用。接下来是几个基本上与这两个相似的几个。
谢谢
我通过向网站的整个目录添加 777 权限解决了这个问题。 chmod -R 777 目录名