How to use location before rewrite

2013-11-04 Thread etrader
I have a set of rewrite rules as rewrite ^/(.*) /script.php?file=$1 last; location ~ \.php$ { php proxy } but I want to make a few exceptions as location = file1|file2|file3 { static delivery } but rewrite will change any static file to php file before the latter location. I cannot use rewrit

How to serve subdomain from subfolder of the domain root?

2013-09-13 Thread etrader
In a server as server { server_name domain.com *.domain.com root /var/www/$server_name; } is it possible to set locations for subdomains based on subfolders of the $server_name ? location matching sub1.domain.com { serving from /var/www/$server_name/sub1 } Currently, I am using a server for e

Re: a regex for rewrite

2013-09-05 Thread etrader
Thanks for very subtle suggestion. I do agree with you and follow this strategy (to use programming language for processing the url arguments). Posted at Nginx Forum: http://forum.nginx.org/read.php?2,242547,242565#msg-242565 ___ nginx mailing list ngi

a regex for rewrite

2013-09-04 Thread etrader
I have a set of rewrites as rewrite ^/(.*)/(.*)/(.*)\.(.*) /script.php?a=$1&b=$2&c=$3&ext=$4 last; rewrite ^/(.*)/(.*)\.(.*) /script.php?a=$1&b=$2&ext=$3 last; rewrite ^/(.*)\.(.*) /script.php?a=$1&ext=$2 last; rewrite ^/(.*)/(.*)/(.*)/(.*) /script.php?a=$1&b=$2&c=$3&d=$4 last; rewrite ^/(.*)/(.*)

How to serve PHP files outside the public folder?

2013-08-25 Thread etrader
For serving the PHP scripts, I use this location location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } now I want to keep a folder outside the public folder to be served

Re: location vs. rewite

2013-04-04 Thread etrader
Anton Yuzhaninov Wrote: --- > > rewrite ^/favicon.ico /var/www/media/images/favicon.X.ico last; > > This is wrong - you can rewrite to other location, not to path on file > system. > Anyway rewrite does not need here, use location. Sorry, my ba

location vs. rewite

2013-04-01 Thread etrader
I want to server favicon from a different place rather than the root folder. As I explored I have two options 1. location = /favicon.ico { alias /var/www/media/images/favicon.X.ico; } 2. rewrite ^/favicon.ico /var/www/media/images/favicon.X.ico last; As I understand the second one needs an addi