Nginx、Wordpress 和 URL 重写问题

编程入门 行业动态 更新时间:2024-10-10 00:24:10
本文介绍了Nginx、Wordpress 和 URL 重写问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

试图让 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 重写问题

本文发布于:2023-11-01 11:13:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549186.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重写   Nginx   Wordpress   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!