从 Apache 迁移到 nginx 时,nginx 错误日志中的 405 错误可能意味着什么?

从 Apache 迁移到 nginx 时,nginx 错误日志中的 405 错误可能意味着什么?

我正在尝试迁移主题从 Apache 安装到在 Debian Wheezy 上运行并使用 php-fmp 的 nginx。我得到的唯一错误是

HTTP/1.1 405 方法不允许

如有任何关于如何解决此问题的提示,我将不胜感激。

这是 /etc/nginx/sites-enabled/my-app 中的网站配置

server {
    listen   80;
    server_name localhost;
    index index.php;
    root /home/my-app/topincs/docroot;
    fastcgi_intercept_errors on;




    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
                }

    location ~ nkm {
        fastcgi_param  TOPINCS_STORE nkm;
        try_files $uri $uri/ /index.php;
        }


    location ~ /\.[0-9]\.[0-9]+\.[0-9](beta\([0-9]+\))? {

        add_header Expires "Fri, 31 Dec 2020 23:59:59 GMT";
            add_header Cache-Control "public";
        }

    location /nkm { 
         rewrite ^/nkm/([3-9]\.[0-9]\.[0-9].*/(.core-topics|css|images|js|vendor|fonts).*)$ /nkm/$1; 
         rewrite ^/nkm((\.|/).*)$ /nkm/.topincs?request=$1; 
         }

    }

以下是原始的 Apache conf 文件:

httpd配置文件

RewriteEngine on
<Directory "/home/my-app/topincs/docroot">
    Order allow,deny
    Allow from all
    DirectoryIndex index.php
    AddType 'text/html; charset=UTF-8' .html
    DefaultType application/x-httpd-php
    php_value include_path "/home/my-app/topincs/php:/home/my-app/topincs/vendor/php"
    php_value default_charset "UTF-8"
    php_value magic_quotes_gpc "0"
    php_value max_execution_time "7200"
    php_value memory_limit "500M"
    php_value short_open_tag "0"
</Directory>

<Directory ~ "/home/my-app/topincs/docroot/[0-9]\.[0-9]+\.[0-9](beta\([0-9]+\))?">
    FileETag none
    Header set Expires "Fri, 31 Dec 2020 23:59:59 GMT"
    Header set Cache-control "public"
</Directory>

Include "/home/my-app/topincs/conf/*.httpd.conf"

/home/my-app/topincs/conf/ 中唯一的其他文件是 nkm.httpd.conf:

<LocationMatch ^/nkm/.*>
    SetEnv TOPINCS_STORE nkm
</LocationMatch>

#RewriteRule ^/nkm/test/(.*)$ /nkm/test/$1 [PT,E=TOPINCS_STORE:nkm]
RewriteRule ^/nkm/([3-9]\.[0-9]\.[0-9].*/(.core-topics|css|images|js|vendor|fonts).*)$ /nkm/$1 [PT,E=TOPINCS_STORE:nkm]
RewriteRule ^/nkm((\.|/).*)$ /nkm/.topincs?request=$1 [PT,L,QSA,E=TOPINCS_STORE:nkm]

Alias /nkm "/home/my-app/topincs/docroot"

并在默认的 /etc/php5/fpm/pool.d/www.conf 中添加了以下几行:

php_value[include_path]  = "/home/my-app/topincs/php:/home/my-app/topincs/vendor/php"
php_value[default_charset] = "UTF-8"
php_value[magic_quotes_gpc] = "0"
php_value[php_value max_execution_time] = "7200"
php_value[php_value memory_limit] = "500M"
php_value[php_value short_open_tag] = "0"

答案1

这些请求是 POST 吗?如果是,这是一个已知问题。请参阅这里

相关内容