免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2320 | 回复: 0
打印 上一主题 下一主题

nginx与Tornado服务中的图片问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-12-27 00:03 |只看该作者 |倒序浏览
本帖最后由 hasea9 于 2011-12-27 11:44 编辑

我用Nginx和Tornado搭建一个环境。
Nginx开80端口,反向代理到本机Tornado的8000端口。
图片放在服务器/www/web/image,配置如下面。

浏览器输入http://xx.xx.xx.xx能够显示(无图片),然后我在浏览器输入http://xx.xx.xx.xx/image/xx.gif时出现404错误。

请教原因,需要怎么配置。

nginx配置
  1. user nginx;
  2. worker_processes 1;

  3. error_log /var/log/nginx/error.log;
  4. pid /var/run/nginx.pid;

  5. events {
  6.     worker_connections 1024;
  7. }

  8. http {
  9.     # Enumerate all the Tornado servers here
  10.     upstream frontends {
  11.         server 127.0.0.1:8000;
  12.     }

  13.     include /etc/nginx/mime.types;
  14.     default_type application/octet-stream;

  15.     access_log /var/log/nginx/access.log;

  16.     keepalive_timeout 65;
  17.     proxy_read_timeout 200;
  18.     sendfile on;
  19.     tcp_nopush on;
  20.     tcp_nodelay on;

  21.     proxy_next_upstream error;

  22.     server {
  23.         listen 80;
  24.         client_max_body_size 50M;

  25.         location ^~ /image/ {
  26.             root /www/web/image;
  27.         }
  28.         location / {
  29.             proxy_pass_header Server;
  30.             proxy_set_header Host $http_host;
  31.             
  32.             proxy_set_header X-Real-IP $remote_addr;
  33.             proxy_set_header X-Scheme $scheme;
  34.             proxy_pass http://frontends;
  35.             proxy_redirect default;        }
  36.     }
  37. }
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP