Welcome! Log In Create A New Profile

Advanced

Re: Need Help Converting .htaccess to Nginx Configuration File

January 05, 2010 01:14AM
On Tue, Jan 5, 2010 at 12:31 PM, Kevin Yusharyahya <lists@ruby-forum.com> wrote:
> 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/.
>
> <IfModule mod_rewrite.c>
> RewriteEngine On
> RewriteBase /
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule . /index.php [L]
> </IfModule>
>
> 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.
> --

ver. 1:

server {
listen <port>;
server_name <something>;

...(root, etc)...

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

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

ver. 2:

server {
listen <port>;
server_name <something>;

...(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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Need Help Converting .htaccess to Nginx Configuration File

Kevin Yusharyahya January 05, 2010 12:38AM

Re: Need Help Converting .htaccess to Nginx Configuration File

edogawaconan January 05, 2010 01:14AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 166
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready