Nginx,Wordpress和URL重写问题

时间:2011-04-11 13:08:55

标签: php wordpress url-rewriting nginx

试图让Nginx和Wordpress很好地玩,但似乎他们还没有相互理解,特别是在漂亮的网址和重写方面。

我的配置文件中底部的nginx有以下片段(从WP上的Nginx的wiki页面获取),我在错误日志中不断收到此错误消息,这让我觉得它甚至没有尝试重写位置。

2011/04/11 09:02:29 [error] 1208#1256: *284 "c:/local/path/2011/04/10/hello-world/index.html" is not found (3: The system cannot find the path specified), client: 127.0.0.1, server: localhost, request: "GET /2011/04/10/hello-world/ HTTP/1.1", host: "dev.local:83"

如果有人可以帮我指点方向或指示或链接或建议,那将是惊人的,因为我严重陷入困境。谢谢!

NGINX

worker_processes  1;
pid        logs/nginx.pid;

events {
    worker_connections  64;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    #gzip
    gzip on;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_min_length  1100;
    gzip_buffers 16 8k;
    gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    # Some version of IE 6 don't handle compression well on some mime-types, so just disable for them
    gzip_disable "MSIE [1-6].(?!.*SV1)";
    # Set a vary header so downstream proxies don't send cached gzipped content to IE6
    gzip_vary on;


    server {
        listen       83;
        server_name  localhost  dev.local;
        root   c:/local/path;
        index  index.php;

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

        #pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:521;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_intercept_errors on;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }

}

1 个答案:

答案 0 :(得分:0)

即使您没有安装cygwin,您指定的绝对路径也会转换为/ cygdrive / c / -path。对于Windows,我建议您尽可能使用相对路径。相对于nginx目录。