在我的django
应用程序中有一个名为media
的目录。我已经在apacheconf文件中声明了这个目录,并且该目录及其所有文件的权限是755。但当我尝试从其url加载图像时,apache会说:
Forbidden
You don't have permission to access /media/foo.jpg on this server.
这是我的apache conf文件:
<VirtualHost *:80>
Alias /static/ /root/websites/FJSharif/static/
<Directory /root/websites/FJSharif/static>
Order deny,allow
Allow from all
Require all granted
</Directory>
Alias /media/ /root/websites/FJSharif/media/
<Directory /root/websites/fJSharif/media>
Order deny,allow
Allow from all
Require all granted
</Directory>
<Directory /root/websites/FJSharif/FJSharif>
<Files wsgi.py>
Order deny,allow
Allow from all
Require all granted
</Files>
</Directory>
WSGIDaemonProcess FJSharif python-path=/root/websites/FJSharif:/home/user/myproject/myprojectenv/lib/python2.7/site-packages:/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages
WSGIProcessGroup FJSharif
WSGIScriptAlias / /root/websites/FJSharif/FJSharif/wsgi.py
</VirtualHost>
当我尝试加载此url时:
http://example.com/media/foo.img
我得到了403禁止的错误。你知道吗
编辑:
Apache可以在/static/
目录中找到文件,但不能在/media/
目录中找到文件!你知道吗
根据我们的讨论,我们排除了一些可能性,但仍然值得再次检查配置文件中的打字错误(例如,路径区分大小写)。很多人经常被这个容易被忽略的细节所困扰。你知道吗
相关问题 更多 >
编程相关推荐