本站教程收集整理的这篇文章主要介绍了nginx django uwsgi静态文件403禁止,本站教程本站觉得挺不错的,现在分享给大家,也给大家做个参考。
嗨?我在CentOS 6.5中部署了一个网站.该框架是django1.7.我使用Nginx和uwsgi.
该网站现在可用,除了403 Forbidden所有静态文件.
我用google搜索了几个小时,并将整个站点文件夹更改为chmod 香港vps 777.文件夹的所有者是kltc,Nginx.conf中的用户也是kltc.
我不知道为什么问题仍然是权限被拒绝.
user kltc;
worker_processes 1;
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name kuaileticao.miyayx.me; # substitute your machine's IP address or FQDN
charset utf-8;
access_log /srv/www/Nginx/kuaileticao.miyayx.me/access.log;
error_log /srv/www/Nginx/kuaileticao.miyayx.me/error.log;
LOCATIOn /static {
autoindex on;
alias /home/kltc/Project/sunny_sports/sunny_sports/static;
}
# Finally, send all non-media requests to the Django server.
LOCATIOn / {
uwsgi_pass 127.0.0.1:8001;
include uwsgi_params; # the uwsgi_params file you installed
}
}
[uwsgi]
# the base directory (full path)
chdir=/home/kltc/Project/sunny_sports
# Django's wsgi file
module=sunny_sports.wsgi:application
master=true
# maximum number of worker processes
processes=10
# the socket (use the full path to be safe
socket=127.0.0.1:8001
chmod-socket=664
chown-socket=kltc:kltc
pidfile=/tmp/project-master.pid
# clear environment on exit
VACUUM=true
max-requests=5000
daemonize=sunny_sportS.Uwsgi.log
[error] 34335#0: *73 open() "/home/kltc/Project/sunny_sports/sunny_sports/static/css/font-awesome.min.css" Failed (13: Permission denied), client: 157.7.154.194, server: kuaileticao.miyayx.me, request: "GET /static/css/font-awesome.min.css http/1.1", host: "kuaileticao.miyayx.me", referrer: "http://kuaileticao.miyayx.me/"
>
[kltc@localhost static]$ps -aux | grep Nginx
root 37444 0.0 0.0 110008 2048 ? Ss 09:02 0:00 Nginx: master process /usr/sbin/Nginx
kltc 37445 0.0 0.0 112548 3700 ? S 09:02 0:00 Nginx: worker process
我尝试了几种方法.例如,将Nginx.conf用户更改为root.但它们都没有奏效.
希望得到你的帮助.谢谢!
解决方法:
确保你的项目(/ homE)的chown父目录可以被Nginx worker读取.
chown -R kltc:kltc /home
chmod -R ug+r /home
本站总结
以上是本站教程为你收集整理的nginx django uwsgi静态文件403禁止全部内容,希望文章能够帮你解决nginx django uwsgi静态文件403禁止所遇到的程序开发问题。
如果觉得本站教程网站内容还不错,欢迎将本站教程推荐给好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。