Are these rules ok?
Igor Sysoev
is at rambler-co.ru
Fri Dec 26 16:35:11 MSK 2008
On Fri, Dec 26, 2008 at 09:10:06PM +0800, Shri @ DevLib.Org wrote:
> After a bit of playing around. I think I have a config that works. (Not
> sure I understand some bits, but it does seem to work across all the
> various sections of the site).
>
> I now have to port over dozens of rewrites I assume the best way to do this
> is to put them in a seperate file and include them under "location /" block?
>
> E.g: #RewriteRule ^hong-kong/(.*)$ http://www.geoexpat.com/resources/
> [R=permanent,L]
No, the better include them in separate locations:
location ^~ /hong-kong/ {
rewrite ^/hong-kong/ http://www.geoexpat.com/resources/ permanent;
}
I see PATH_INFO in wordpress and classifieds locations, does this mean
that you were not able to run them without PATH_INFO ? (I see that vbulliten
has no PATH_INFO processing).
If so, I probably should invent to extract PATH_INFO in easy way.
> Once that is done, need to figure out the
>
> Thanks!
>
> Shri
>
>
> server {
>
> listen 80;
> server_name geoexpat.com www.geoexpat.com;
>
> root /site/expat/oct08;
>
> index index.php index.html index.htm;
>
> location / {
> try_files $uri @wordpress;
> }
>
>
> location ~ \.php$ {
> try_files $uri @wordpress;
>
> set $script $uri;
> set $path_info "";
>
> if ($uri ~ "^(.+\.php)(/.+)") {
> set $script $1;
> set $path_info $2;
> }
>
> fastcgi_param SCRIPT_FILENAME
> /site/expat/oct08$fastcgi_script_name;
> fastcgi_pass unix:/var/tmp/lighttpd/fastcgi-php.sock;
> # fastcgi_param PATH_INFO $path_info;
> include fastcgi_params;
> }
>
> location @wordpress {
> fastcgi_param SCRIPT_FILENAME /site/expat/oct08/index.php;
> fastcgi_pass unix:/var/tmp/lighttpd/fastcgi-php.sock;
> fastcgi_param PATH_INFO $path_info;
> include fastcgi_params;
> }
>
> location ~* \.(jpg|jpeg|gif|css|png|js|ico)$ {
> access_log off;
> expires 30d;
> break;
> }
>
> location /classifieds/ {
> try_files $uri @wordpress;
>
> set $script $uri;
> set $path_info "";
>
> if ($uri ~ "^(.+\.php)(/.+)") {
> set $script $1;
> set $path_info $2;
> }
>
> fastcgi_param SCRIPT_FILENAME
> /site/expat/oct08$fastcgi_script_name;
> fastcgi_pass unix:/var/tmp/lighttpd/fastcgi-php.sock;
> fastcgi_param PATH_INFO $path_info;
> include fastcgi_params;
> }
>
> location ^~ /scripts/ {
> proxy_pass http://cgiserver;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header Host $host;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> }
>
> location ^~ /resources/Detailed/ {
> proxy_pass http://cgiserver;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header Host $host;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> }
>
> location /forum/ {
> rewrite ^/forum/getnew.html$ /forum/search.php?do=getnew
> last;
> rewrite ^/forum/getnew([0-9]+).html$
> /forum/search.php?do=getnew&f=$1 last;
> rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$
> /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
> rewrite ^/forum/unanswered.html$
> /forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1 last;
> rewrite ^/forum/unanswered([0-9]+).html$
> /forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1&forumchoice=$1&childforums=1
> last;
> try_files $uri @vbulletin;
> }
>
> location ~ ^/forum/.+\.php$ {
> fastcgi_pass unix:/var/tmp/lighttpd/fastcgi-php.sock;
> fastcgi_param SCRIPT_FILENAME
> /site/expat/oct08/forum/vbseo.php;
> include fastcgi_params;
> }
>
> location @vbulletin {
> fastcgi_pass unix:/var/tmp/lighttpd/fastcgi-php.sock;
> fastcgi_param SCRIPT_FILENAME
> /site/expat/oct08/forum/vbseo.php;
> include fastcgi_params;
> }
>
> location /jobs/ {
> rewrite ^/jobs/category/(.+)$ /jobs/index.php?cat_name=$1
> last;
> rewrite ^/jobs/job/(.+)$
> /jobs/index.php?post_permalink=1&post_id=$1 last;
> rewrite ^/jobs/profile/(.+)$ /jobs/index.php?show_emp=$1
> last;
> rewrite ^/jobs/page(.+)$ /jobs/index.php?job_page_link=$1
> last;
> }
>
> location ~ /\.ht {
> deny all;
> }
> }
>
>
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list