U
U
Uniq2017-05-29 18:28:13
PHP
Uniq, 2017-05-29 18:28:13

NGINX post requests not working after slash how to fix?

Let's say the site: site.com/
if you send POST requests: site.com/test - then everything works fine
if you do this: site.com/test/test 404 error
Router on php Macaw and on 1 server everything works fine on the other no
GET requests all work out completely
. All links are processed through index.php, since it loads the router.
Debian 8 system + NGINX + 1.10.3 + PHP-7.0-FMP + PERL
nothing more
CONFIG NGINX cgi

scgi_param  REQUEST_METHOD     $request_method;
scgi_param  REQUEST_URI        $request_uri;
scgi_param  QUERY_STRING       $query_string;
scgi_param  CONTENT_TYPE       $content_type;

scgi_param  DOCUMENT_URI       $document_uri;
scgi_param  DOCUMENT_ROOT      $document_root;
scgi_param  SCGI               1;
scgi_param  SERVER_PROTOCOL    $server_protocol;
scgi_param  REQUEST_SCHEME     $scheme;
scgi_param  HTTPS              $https if_not_empty;

scgi_param  REMOTE_ADDR        $remote_addr;
scgi_param  REMOTE_PORT        $remote_port;
scgi_param  SERVER_PORT        $server_port;
scgi_param  SERVER_NAME        $server_name;



fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  SERVER_NAME        $server_name;
fastcgi_param  REDIRECT_STATUS    200;

NGINX SERVER CONFIG:
set $root_path /var/www/public/site.ru;
  root /var/www/public/site.ru;
  index index.php;

  location / {
     alias /var/www/public/site.ru;
 			try_files $uri @method;
      }

  location @method{
  fastcgi_pass unix:/run/php/php7.0-fpm.sock;
  fastcgi_index  index.php;
  include /etc/nginx/fastcgi_params;	
  fastcgi_param  SCRIPT_FILENAME $document_root/index.php;
  

  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2017-05-30
@padonnak

Nginx redirects /test/test request to index.php
Why index.php returns 404 is another matter entirely.
PS You can throw out redundant set $root_path, alias

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question