【问题标题】:nginx Wordpress URL rewritenginx Wordpress URL 重写
【发布时间】:2011-12-10 20:26:04
【问题描述】:

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

Wordpress URL 应该如下所示: http://localhost/website/blog/2011/10/sample-post/

我看过本教程:http://wiki.nginx.org/WordPress + 网络上的许多其他教程,但每次我收到 404 错误(有时是 403)。

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

    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 禁止”状态。

我错过了什么?

【问题讨论】:

    标签: wordpress url-rewriting nginx php


    【解决方案1】:

    您是否在保存配置后尝试重新启动 nginx?

    另外,请在此处查看我的 nginx/WordPress 设置指南:

    http://themesforge.com/featured/high-performance-wordpress-part-3/

    【讨论】:

      【解决方案2】:

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

      这是我用于 wordpress 的示例

      server {
      listen 80;
      server_name www.mysite.com mysite.com;
      root /srv/www/mysite.com/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.com/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;
          }
      

      }

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-11-24
        • 2016-05-25
        • 2012-04-21
        • 2012-03-26
        • 2015-09-09
        • 1970-01-01
        相关资源
        最近更新 更多