【问题标题】:Nginx, Wordpress and URL rewriting problemsNginx、Wordpress 和 URL 重写问题
【发布时间】:2011-04-11 21:34:33
【问题描述】:

试图让 Nginx 和 Wordpress 玩得很好,但似乎他们还不太了解对方,尤其是在漂亮的 url 和重写方面。

我在底部的 nginx 配置文件中有以下 sn-p(从 Nginx 在 WP 上的 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;
        }
    }

}

【问题讨论】:

    标签: php wordpress url-rewriting nginx


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-10
      • 1970-01-01
      • 2019-11-24
      • 2011-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多