Are these rules ok?
Shri @ DevLib.Org
shri at devlib.org
Fri Dec 26 17:33:58 MSK 2008
Igor,
Photopost Classifieds, the package that I use for the classifieds needs
Pathinfo for sure.
Wordpress also seems to use PATH_INFO ( wp-includes/classes.php has a
function called parse-request ) for its clean URL functions, so I figured I
better enable it. $pathinfo is used a fair bit in the code.
-----------
if ( isset($_SERVER['PATH_INFO']) )
$pathinfo = $_SERVER['PATH_INFO'];
else
$pathinfo = '';
$pathinfo_array = explode('?', $pathinfo);
$pathinfo = str_replace("%", "%25",
$pathinfo_array[0]);
-----------
Also, I forgot to add that there was a bit of vBulletin code that behaved
strangely. Essentially it was deleting a number of cookies in a tight loop.
Obviously this must have been a problem on some platforms as there was this
remark in the code.
if (!defined('SKIP_AGGRESSIVE_LOGOUT'))
{
// sending this many headers has caused
problems with a few
// servers, especially with IIS. Defining
SKIP_AGGRESSIVE_LOGOUT
// reduces the number of cookie headers
returned.
Will have to look at the various options for header buffers etc. For now,
defining SKIP_AGGRESSIVE_LOGOUT bypasses the problems.
Regards,
Shri
----- Original Message -----
From: "Igor Sysoev" <is at rambler-co.ru>
To: <nginx at sysoev.ru>
Sent: Friday, December 26, 2008 9:35 PM
Subject: Re: Are these rules ok?
> 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