Need Help Converting .htaccess to Nginx Configuration File

Hi all,
I just moved my site from an Apache-based webserver into a Nginx-based
webserver. As a result, all of my site’s permalinks are broken. Can
anyone help me convert my .htaccess into Nginx configuration files?
Here’s my .htaccess - for your information, I’m just running a simple
WordPress site. The .htaccess is on /, not on some /dir/.

RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

I read some articles in the web and after trying to convert it myself
here’s what I get.

if (!-f $request_filename){
set $rule_0 1$rule_0;
}
if (!-d $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = “21”){
rewrite /. /index.php last;
}

Is that right? Where should I put that? In
/usr/local/nginx/conf/nginx.conf? I have three sites running in three
domains in the server and I just want this to run at one domain.

On Tue, Jan 5, 2010 at 12:31 PM, Kevin Yusharyahya
[email protected] wrote:

RewriteCond %{REQUEST_FILENAME} !-f
if (!-d $request_filename){
 set $rule_0 2$rule_0;
}
if ($rule_0 = “21”){
 rewrite /. /index.php last;
}

Is that right? Where should I put that? In
/usr/local/nginx/conf/nginx.conf? I have three sites running in three
domains in the server and I just want this to run at one domain.

ver. 1:

server {
listen ;
server_name ;

…(root, etc)…

location / {
try_files $uri $uri/ /index.php;
}

location ~ .php$ {
…(something)…
}
}

ver. 2:

server {
listen ;
server_name ;

…(root, php, etc)…

location / {
try_files $uri $uri/ @fallback;
}

location @fallback {
fastcgi_param SCRIPT_FILENAME /path/to/index.php;
…(something)…
}
}


O< ascii ribbon campaign - stop html mail - www.asciiribbon.org