search

Home  >  Q&A  >  body text

python - nginx的静态文件没有端口号就无法访问

我的nginx在网页的静态文件上遇到了一些问题
目前查看网页上解析出来css的地址在http://138.128.197.124/static...
我的location部分这么写的
location /static/ {
alias /root/djangoBlog/jasonBlog/static/;
}
确认过所有的static文件都是在这个目录下面的,想请问下为何无法访问呢
在想是不是因为我监听的是8077端口,这里的css地址也应该是ip:8077?请问该如何修改呢

PHPzPHPz2893 days ago339

reply all(3)I'll reply

  • 迷茫

    迷茫2017-04-18 09:40:34

    Thank you for your help. I found the problem. The permissions I configured for nginx were not enough. I will fix it after modifying it.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 09:40:34

    You can only forward it if you request the port you are listening on in nginx. You requested port 80, so naturally it cannot be found.

    reply
    0
  • 阿神

    阿神2017-04-18 09:40:34

    location /static/ {
    alias /root/djangoBlog/jasonBlog/static/;
    }

    Just put this part on port 80
    Or you can proxy port 8077 under port 80

    reply
    0
  • Cancelreply