3
好吧,我在Nginx上是n00b,我浏览过这里,无法拼凑出答案。因此,这里是我得到Nginx重写所有的目录请求到index.php
server {
root /usr/share/nginx/www;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location/{
# First attempt to serve request as file, then
# as directory, then fall back to index.html
if (-f $request_filename) {
expires 30d;
break;
}
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
}
location /dojump {
rewrite ^/dojump/(.*)$ /dojump/index.php/$1 break;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
这是一个WordPress安装的第一个位置块应该通过所有的文件请求到WordPress的引导。
location /dojump
块应该用于出站重定向脚本。我想赶上参数并将其传递给index.php的脚本
像/dojump/cnn.com 到/dojump/index.php/cnn.com
它的工作原理与Apache这个简单的的.htaccess线dojumps文件夹内
RewriteRule ^(.*)$ index.php/$1 [L]
不过,我得到的错误日志
/usr/share/nginx/www/dojump/index.php/cnn.com" failed (20: Not a directory)
Nginx上错误
任何帮助?
谢谢
很多类似的问题:http://stackoverflow.com/questions/5920081/ http://stackoverflow.com/questions/3255446/ Nginx已经致力于WordPress的页面:http://wiki.nginx .org/Wordpress –