Wordpress Permalinks
Sven Ludwig
nginx at abraumhal.de
Thu Feb 16 23:57:25 UTC 2012
On 02-16 18:10, justin wrote:
> Howdy.
>
> So I am trying to get permalinks to work with Wordpress. I have read a
> few articles/blog posts but still no luck. The permalink structure I am
> trying to use is:
>
> http://mydomain.com/wp/index.php/2012/02/sample-post/
>
> Here is the configuration block that I am currently using that is
> important:
>
> # permalinks currently not working with this
> location ~ \.php$ {
> include /etc/nginx/fastcgi_params;
> fastcgi_intercept_errors off;
> fastcgi_index index.php;
>
> try_files $uri $uri/ /index.php?q=$uri&$args;
>
> # tried this as well, but still doesn't work
> #
> #if (!-e $request_filename) {
> # rewrite ^.*$ /index.php last;
> #}
>
> fastcgi_pass php1.local.mydomain.com:9000;
> }
this is a solution i found for running wordpress behind nginx and it works :)
location / {
set $rewrite_to_php "true";
if ( -f $request_filename) {
set $rewrite_to_php "false";
}
if ( -d $request_filename) {
set $rewrite_to_php "false";
}
if ( $rewrite_to_php = "true" ) {
rewrite ^(.*)$ /index.php?q=$1 last;
break;
}
}
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
expires max;
}
location ~* \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
}
if you depend on try_files you might change the "location /" section this way:
location / {
try_files $uri $uri/ /index.php?q=$1;
}
i didn't test it, but as written in the wiki, this should work also :)
http://wiki.nginx.org/HttpCoreModule#try_files
bye MUH!
--
;__;___,
)..(_=_)
(oo)| |
More information about the nginx
mailing list