I
I
Igor Bezlepkin2019-01-10 15:20:52
Nginx
Igor Bezlepkin, 2019-01-10 15:20:52

How to send all POST requests to index.php in nginx?

Hey! I'm making a file upload server. You need to send post requests to index.php and get to display statics.
Tell me the config please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2019-01-12
@BorisKorobkov

if ($request_method = POST) {
    rewrite ^ /index.php break;
  }

  location = /index.php {
    internal;
    fastcgi_pass    unix:/run/php/php7.3-fpm.sock;
    fastcgi_index   index.php;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include         fastcgi_params;
  }
  
  location = / {
    try_files $uri $uri/;
  }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question