nginx Wordpress URL重写

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

我刚刚安装了nginx 1.0.8和php-fpm,在过去的30分钟里,我正尝试为Wordpress重写URL.

I've just installed nginx 1.0.8 and php-fpm and for the last 30 minutes I'm trying to rewrite the URL for Wordpress.

以下是Wordpress URL的外观: localhost/website/blog/2011/10/sample-post/

Here is what the Wordpress URL should look like: localhost/website/blog/2011/10/sample-post/

我看过本教程: wiki.nginx/WordPress +网络上还有很多其他功能,但是每次我收到404错误(有时是403)时.

I've looked at this tutorial: wiki.nginx/WordPress + many other on the web but every time I receive an 404 error (sometimes 403).

这是我在配置文件中所做的:

Here is what I did in my configuration file:

location /website/blog { try_files $uri $uri/ /website/blog/index.php; } location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; fastcgi_split_path_info ^(/website/blog)(/.*)$; include fastcgi_params; error_page 404 /404.html; }

使用此配置,我收到"403禁止访问"状态.

With this configuration I'm receiving "403 forbidden" status.

我想念什么?

推荐答案

可能是根站点文件夹的权限

Could be the permission of the root site folder

这是我用于wordpress的示例

This is an example that i use to wordpress

server { listen 80; server_name www.mysite mysite; root /srv/www/mysite/public_html; location / { index index.html index.htm index.php; try_files $uri $uri/ /index.php?$args; } rewrite /wp-admin$ $scheme://$host$uri/ permanent; include /srv/www/mysite/public_html/*.conf; location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }

}

更多推荐

nginx Wordpress URL重写

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

发布评论

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

>www.elefans.com

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