2009/6/18 Igor Sysoev <span dir="ltr"><<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">On Thu, Jun 18, 2009 at 05:26:02PM -0700, Kevin Castiglione wrote:<br>
<br>
> 2009/6/18 Igor Sysoev <<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>><br>
><br>
> > On Thu, Jun 18, 2009 at 08:10:27AM -0700, Kevin Castiglione wrote:<br>
> ><br>
> > > 2009/6/18 Igor Sysoev <<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>><br>
> > ><br>
> > > > On Thu, Jun 18, 2009 at 07:44:55AM -0700, Kevin Castiglione wrote:<br>
> > > ><br>
> > > > > 2009/6/18 Igor Sysoev <<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>><br>
> > > > ><br>
> > > > > > On Thu, Jun 18, 2009 at 07:21:33AM -0700, Kevin Castiglione wrote:<br>
> > > > > ><br>
> > > > > > > 2009/6/18 Igor Sysoev <<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>><br>
> > > > > > ><br>
> > > > > > > > On Thu, Jun 18, 2009 at 06:38:54AM -0700, Kevin Castiglione<br>
> > wrote:<br>
> > > > > > > ><br>
> > > > > > > > > 2009/6/18 Igor Sysoev <<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>><br>
> > > > > > > > ><br>
> > > > > > > > > > On Wed, Jun 17, 2009 at 09:22:46PM -0700, Kevin Castiglione<br>
> > > > wrote:<br>
> > > > > > > > > ><br>
> > > > > > > > > > > hei guys<br>
> > > > > > > > > > > i want all urls to be re-written as follows:<br>
> > > > > > > > > > ><br>
> > > > > > > > > > > xx /host/xx<br>
> > > > > > > > > > ><br>
> > > > > > > > > > > xx is the url full path, it should be written as<br>
> > /domain/xx<br>
> > > > where<br>
> > > > > > > > host is<br>
> > > > > > > > > > > the hostname.<br>
> > > > > > > > > > ><br>
> > > > > > > > > > > for example <a href="http://www.ABCD.COM" target="_blank">www.ABCD.COM</a> <<a href="http://www.abcd.com/" target="_blank">http://www.abcd.com/</a>><br>
> > > > > > > > > > ><br>
> > > > > > > > > > > /test?1 ---> /<a href="http://ABCD.COM/test?1" target="_blank">ABCD.COM/test?1</a> <<a href="http://abcd.com/test?1" target="_blank">http://abcd.com/test?1</a>><br>
> > > > > > > > > > > is it possible to do this with nginx?<br>
> > > > > > > > > > > thank you!<br>
> > > > > > > > > ><br>
> > > > > > > > > > Should it be redirect or what ?<br>
> > > > > > > > > ><br>
> > > > > > > > ><br>
> > > > > > > > > i dont want it to be a permanent redirect. i just want the<br>
> > url to<br>
> > > > be<br>
> > > > > > > > > rewritten for application processing. i want different<br>
> > domains to<br>
> > > > be<br>
> > > > > > > > handled<br>
> > > > > > > > > by same web app an dmy webframe work supports only url-level<br>
> > > > > > application<br>
> > > > > > > > > mapping. that is why i need this rewrite.<br>
> > > > > > > > > thank you<br>
> > > > > > > ><br>
> > > > > > > > If you use proxing, then<br>
> > > > > > > ><br>
> > > > > > > > server {<br>
> > > > > > > ><br>
> > > > > > > > location / {<br>
> > > > > > > > proxy_pass <a href="http://backend/$host$request_uri" target="_blank">http://backend/$host$request_uri</a>;<br>
> > > > > > > > }<br>
> > > > > > > ><br>
> > > > > > > > }<br>
> > > > > > > ><br>
> > > > > > > im using fastcgi backend.<br>
> > > > > ><br>
> > > > > > Then<br>
> > > > > ><br>
> > > > > > location / {<br>
> > > > > > ...<br>
> > > > > > fastcgi_param SCRIPT_FILENAME<br>
> > > > > > /path/to/scripts/$host$fastcgi_script_name;<br>
> > > > > > ...<br>
> > > > > > }<br>
> > > > > ><br>
> > > > > igor:<br>
> > > > > does this mean the backend fastcgi processes have to be in the same<br>
> > > > machine?<br>
> > > > > i have my backends running on different machine like this<br>
> > > ><br>
> > > > No, this path<br>
> > > > /path/to/scripts/$host$fastcgi_script_name;<br>
> > > > may be on any host.<br>
> > > ><br>
> > > > In your case you need probably this:<br>
> > > ><br>
> > > > fastcgi_param SCRIPT_FILENAME /$host$fastcgi_script_name;<br>
> > ><br>
> > > so with this i dont need to write any rewrite rule?<br>
> ><br>
> > Yes.<br>
> ><br>
> igor,<br>
> i changed this and tried. it does not have any affect on the url mapping. my<br>
> fastcgi backend still gets the same url as before.<br>
> this is what i see, with the change you had given.<br>
> <a href="http://xx.com/yy" target="_blank">xx.com/yy</a> ---> <a href="http://xx.com/yy" target="_blank">xx.com/yy</a><br>
><br>
> while this is what i want on the webapp/fastcgi backend<br>
> <a href="http://xx.com/yy" target="_blank">xx.com/yy</a> --> <a href="http://xx.com/xx.com/yy" target="_blank">xx.com/xx.com/yy</a><br>
> im pasting my full config here:<br>
><br>
> #user nobody;<br>
> worker_processes 1;<br>
><br>
> error_log /home/app/error_all.log;<br>
> pid /home/app/nginx.pid;<br>
><br>
> events {<br>
> worker_connections 1024;<br>
> }<br>
><br>
> http {<br>
> include mime.types;<br>
> default_type application/octet-stream;<br>
> client_header_buffer_size 8k;<br>
> large_client_header_buffers 4 8k;<br>
> fastcgi_buffers 32 4k;<br>
> fastcgi_buffer_size 4k;<br>
> sendfile on;<br>
><br>
> server_names_hash_bucket_size 64;<br>
> keepalive_timeout 5;<br>
><br>
> gzip on;<br>
> gzip_comp_level 1;<br>
> gzip_proxied private;<br>
> gzip_buffers 8 4k;<br>
><br>
><br>
> upstream backend_flock{<br>
> server <a href="http://app1.XXX.com:8492" target="_blank">app1.XXX.com:8492</a> fail_timeout=1s;<br>
> }<br>
> server {<br>
> listen 8080;<br>
> access_log /home/app/access_flock.log;<br>
><br>
> client_max_body_size 10m;<br>
><br>
> location /static {<br>
> root /home/app/work/flock;<br>
> }<br>
> location / {<br>
> root /home/app/work/flock;<br>
><br>
> fastcgi_pass backend_flock;<br>
><br>
> fastcgi_param SCRIPT_FILENAME /$host$fastcgi_script_name;<br>
> fastcgi_param PATH_INFO $fastcgi_script_name;<br>
> fastcgi_param QUERY_STRING $query_string;<br>
> fastcgi_param CONTENT_TYPE $content_type;<br>
> fastcgi_param CONTENT_LENGTH $content_length;<br>
> fastcgi_param REQUEST_METHOD $request_method;<br>
> fastcgi_param REMOTE_ADDR $remote_addr;<br>
> fastcgi_param REMOTE_PORT $remote_port;<br>
> fastcgi_param SERVER_PROTOCOL $server_protocol;<br>
> fastcgi_param SERVER_ADDR $server_addr;<br>
> fastcgi_param SERVER_PORT $server_port;<br>
> fastcgi_param SERVER_NAME $server_name;<br>
><br>
> }<br>
><br>
> }<br>
> }<br>
<br>
</div></div>Probably, you need<br>
<br>
fastcgi_param SCRIPT_FILENAME /home/app/work/flock/$host$fastcgi_script_name;<br>
<br>
or<br>
<br>
fastcgi_param SCRIPT_FILENAME $document_root/$host$fastcgi_script_name;<br>
</blockquote><div>tried these with no results igor!<br>thanks <br></div></div><br>