试图让 Nginx 和 Wordpress 玩得很好,但他们似乎还不太了解对方,尤其是在漂亮的 url 和重写方面.
Trying to get Nginx and Wordpress to play nicely but it seems that they don't understand each other quite yet, especially in terms of pretty urls and rewriting.
我在底部的 nginx 配置文件中有以下片段(从 WP 上的 Nginx wiki 页面获取),并且我一直在错误日志中收到此错误消息,这让我觉得它甚至没有尝试重写位置.
I have the following snippet in my config file for nginx at the bottom (got it from Nginx's wiki page on WP), and I keep getting this error message in my error log, which makes me think it's not even trying to rewrite the location.
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"如果有人能帮我提供方向、指示、链接或建议,那将是非常棒的,因为我真的被卡住了.谢谢!
If anyone can help give me direction or pointers or links or suggestions, that would be amazing because I'm seriously stuck. Thanks!
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; } } } 推荐答案即使您没有安装 cygwin,您指定的绝对路径也会被转换为/cygdrive/c/-path.对于 Windows,我建议您尽可能使用相对路径.相对于nginx目录.
Absolute paths like the one you specified gets translated into a /cygdrive/c/-path even if you don't have cygwin installed. For Windows I suggest you use relative paths if possible. Relative to the nginx directory.
更多推荐
Nginx、Wordpress 和 URL 重写问题
发布评论