Как заставить nginx + php-fpm вести себя как apache в запросах ".php / args" - PullRequest
0 голосов
/ 25 сентября 2019

Рассмотрим следующий пример URI

http://teste.com/test.php/8455

При доступе к этому на Apache apache отправляет запрос в файл "test.php".Однако при доступе к тому же URI на nginx с php-fpm он выдал ошибку «not found», почему ведет себя по-разному и как я могу заставить их вести себя одинаково?

Это моеКонфигурация перенаправления .htacces:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_URI} !=/server-status
RewriteCond %{ENV:REDIRECT_STATUS} 200 [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

Это моя конфигурация сервера nginx

server {
    listen   80;
    root /var/www/html;
    index index.php index.html;
    location ~ .php$ {
            try_files $request_uri $request_uri/ =404;
            fastcgi_pass 127.0.0.1:10000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
    }

    location / {
        try_files $request_uri =404;
    }


    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
            root /usr/share/nginx/www;
    }
}
...