- 论坛徽章:
- 0
|
本帖最后由 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配置- user nginx;
- worker_processes 1;
- error_log /var/log/nginx/error.log;
- pid /var/run/nginx.pid;
- events {
- worker_connections 1024;
- }
- http {
- # Enumerate all the Tornado servers here
- upstream frontends {
- server 127.0.0.1:8000;
- }
- include /etc/nginx/mime.types;
- default_type application/octet-stream;
- access_log /var/log/nginx/access.log;
- keepalive_timeout 65;
- proxy_read_timeout 200;
- sendfile on;
- tcp_nopush on;
- tcp_nodelay on;
- proxy_next_upstream error;
- server {
- listen 80;
- client_max_body_size 50M;
- location ^~ /image/ {
- root /www/web/image;
- }
- location / {
- proxy_pass_header Server;
- proxy_set_header Host $http_host;
-
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Scheme $scheme;
- proxy_pass http://frontends;
- proxy_redirect default; }
- }
- }
复制代码 |
|