Help to config nginx

hello, (sorry for my English)

I’m testing nginx as a proxy in front of apache.

this is my config file…

user apache apache;
worker_processes 1;

#log levels [ debug | info | notice | warn | error | crit ]
error_log /usr/local/nginx/logs/error.log notice;

pid /usr/local/nginx/logs/nginx.pid;

events {
worker_connections 1024;
}

http{
include mime.types;
default_type application/octet-stream;

#Timeouts and KeepAlive
keepalive_timeout 4 4;
keepalive_requests 100;
#General Options
sendfile on;
server_tokens off;
autoindex off;
client_max_body_size 10m;

#TCP options
tcp_nodelay on;
tcp_nopush off;

#Compression
gzip on;
gzip_comp_level 6;
gzip_proxied off;
gzip_vary off;
gzip_types text/plain text/xml application/x-javascript text/css;

#Log Format
log_format main '$remote_addr $host $remote_user [$time_local]
“$request” ’
‘$status $body_bytes_sent “$http_referer”
“$http_user_agent” “$gzip_ratio”’;

server {
listen *:80;
    server_name  --------;
root /---------/;
index index.php index.html index.htm;
    access_log  /usr/local/nginx/logs/access.log  main;

location ~ /\.ht {
  deny  all;
}

location ~ 

.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf|avi|mp3)$
{
expires 30d;
break;
}

#rules mod rewrite

rewrite "^/noticia/([0-9\\\*]{1,20})/(.*)$" /noticia.php?id=$1 last;
rewrite "^/noticia-lectores/([0-9\\\*]{1,20})/(.*)$" 

/part_noticia.php?id=$1 last;
rewrite “^/cartas/([0-9\*]{1,20})/(.)$" /part_carta.php?id=$1
last;
rewrite "^/galeria/([0-9\*]{1,20})/(.
)$”
/galeria.php?id=$1&idfoto=$2 last;
rewrite “^/enimagenes/([0-9\*]{1,20})/(.)$"
/part_enimagen.php?id=$1&idfoto=$2 last;
rewrite "^/galeria_usuario/([0-9\*]{1,20})/(.
)$”
/galeria_usuario.php?id=$1&idfoto=$2 last;
rewrite “^/utiles/([0-9\*]{1,20})/(.)/$" /utiles.php?seccion=$1
last;
rewrite “^/pregunta/([0-9]{1,20})/$”
/part_pregunta.php?idpregunta=$1 last;
rewrite "^/debates/(.
)$” /part_debateslocales.php?tipo=$1 last;
rewrite “^/usuarios/perfil/([0-9]{1,20})$”
/usuarios/perfil.php?idusuario=$1 last;
rewrite “^/videoslectores/([0-9]{1,20})$” /videoslectores2.php?id=$1
last;
rewrite “^/opinion/([0-9\*]{1,20})/$” /noticia_opinion.php?id=$1
last;

    #Proxy the PHP scripts to Apache listening on 127.0.0.1:8080
    location ~ \.php$ {
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_buffering off;
  if ($request_uri ~ /resize.php){
    expires 30d;
  }
  proxy_pass   http://127.0.0.1:8080;
    }

}

}

well:

– some images from my website, I resize with php, and if I not disable
proxy_buffering does not load entire, just the beginning, about 1 / 3 to
1 / 2 of the image (the same as this http://www.eglx.com/J/bug.JPG),
because this happens to activate the proxy_buffering (proxy_buffering
on)? any help?

– I read something about the header “X-Accel-Redirect” then, I wonder
if I can use to get something like this:
http://kovyrin.net/wp-content/uploads/2006/05/algorithm_c.png because
in my resize.php not resize some images, simply do
header(“Content-type: image/gif”); readfile($pic);

thank you very much!!!

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,5471,5471#msg-5471

On Wed, Sep 2, 2009 at 7:50 AM, pepejose[email protected] wrote:

– I read something about the header “X-Accel-Redirect” then, I wonder if I can use to get something like this:
http://kovyrin.net/wp-content/uploads/2006/05/algorithm_c.png  because in my resize.php not resize some images, simply do  header(“Content-type: image/gif”); readfile($pic);

this should work.

header(“Content-type: image/gif”);
header(“X-Accel-Redirect: $pic”);
exit();

However note that $pic needs to be the relative image path, not the
full file path on the filesystem. So it needs to be slightly modified
as $pic would currently be /home/foo/web/foo.com/dir/image.gif, you’d
need it to be just /dir/image.gif

Michael S. Wrote:

full file path on the filesystem. So it needs to
be slightly modified
as $pic would currently be
/home/foo/web/foo.com/dir/image.gif, you’d
need it to be just /dir/image.gif

hi,

I’ll try that. thanks!

and the problem with large images with “proxy_buffering on”?
(http://www.eglx.com/J/bug.JPG)

greetings

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,5514,5543#msg-5543

UP! UP!

and the problem with large images with “proxy_buffering on”?
(http://www.eglx.com/J/bug.JPG)

I have to increase the size of the buffers or configure something else?

greetings

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,5514,5728#msg-5728

hi,

I can not look now because I have just apache, and I can not put nginx
now but when I can, I look and I put here the error.

thank you very much

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,5514,5730#msg-5730

On Mon, Sep 07, 2009 at 03:05:34AM -0400, pepejose wrote:

UP! UP!

and the problem with large images with “proxy_buffering on”? (http://www.eglx.com/J/bug.JPG)

I have to increase the size of the buffers or configure something else?

Have you looked in error_log ?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs