nginx + wordpress rewrite question

merlin corey merlincorey at dc949.org
Wed Feb 10 02:37:09 MSK 2010


On Mon, Feb 8, 2010 at 11:34 PM, Edho P Arief <edhoprima at gmail.com> wrote:
> On Tue, Feb 9, 2010 at 2:21 PM, Edho P Arief <edhoprima at gmail.com> wrote:
>> wordpress is pretty smart in handling rewrites
>>
>> here's example for wordpress installation in a root of a domain:
>>
>> server {
>>  listen 80;
>>  server_name my.blog.com;
>>  location ~ ^/.*\.php$ {
>>    root /srv/http/wordpress;
>>    fastcgi_pass 127.0.0.1:9100;
>>    fastcgi_index index.php;
>>    fastcgi_param SCRIPT_FILENAME $request_filename;
>>    include fastcgi_params;
>>  }
>>  location / {
>>    index index.php;
>>    root /srv/http/wordpress;
>>    try_files $uri /index.php;
>>    expires max;
>>  }
>> }
>>
>>
>>
>
> inside a directory, it'd be either:
>
> server {
>  listen 80;
>  server_name my.blog.com;
>  location ~ ^/blog/.*\.php$ {
>   root /srv/http/wordpress;
>   fastcgi_pass 127.0.0.1:9100;
>   fastcgi_index index.php;
>   fastcgi_param SCRIPT_FILENAME $request_filename;
>   include fastcgi_params;
>  }
>  location /blog/ {
>   index index.php;
>   root /srv/http/wordpress;
>   try_files $uri /index.php;
>   expires max;
>  }
>  location = /blog {
>    rewrite ^ /index.php;
>  }
> }
>
> and then create symlink /srv/http/wordpress/blog pointing to
> /srv/http/wordpress;
>
> or
>
> server {
>  listen 80;
>  server_name my.blog.com;
>  location ~ ^/blog/(.*\.php)$ {
>    alias /srv/http/wordpress/$1;
>    fastcgi_pass 127.0.0.1:9100;
>    fastcgi_index index.php;
>    fastcgi_param SCRIPT_FILENAME $request_filename;
>    include fastcgi_params;
>  }
>  location /blog/ {
>    index index.php;
>    alias /srv/http/wordpress/;
>    error_page 404 = /index.php;
>    expires max;
>  }
>  location = /blog {
>    rewrite ^ /blog/index.php;
>  }
> }
>
>
> --
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>

http://wiki.nginx.org/Wordpress

No need for symlinks, and a million ways to do things.  Still need to
add in that supercache config I wrote like a year ago for someone but
I want to test it first :P~.

-- Merlin



More information about the nginx mailing list