【发布时间】:2011-08-16 21:54:53
【问题描述】:
好的,我在 Nginx 上有点 n00b,我已经浏览过这里,无法拼凑出答案。所以这就是我得到的
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
通过 dojumps 文件夹中的这个简单的 .htaccess 行与 apache 配合使用
RewriteRule ^(.*)$ index.php/$1 [L]
但是,我在 错误日志
中收到一个 nginx 错误/usr/share/nginx/www/dojump/index.php/cnn.com" failed (20: Not a directory)
有什么帮助吗?
谢谢
【问题讨论】:
-
很多类似的问题:stackoverflow.com/questions/5920081stackoverflow.com/questions/3255446Nginx 有一个专门用于 Wordpress 的页面:wiki.nginx.org/Wordpress