Nginx block all request except GET.

If you want to block a specific type of HTTP request methods like POST, then use limit_except directive.

Edit your /etc/nginx/sites-enabled/<your-app>

  location ~* {
    limit_except GET {
      deny all;

Restart your server:

sudo service nginx restart

If the restart fails, then you might have made a syntax error in your nginx configuration. After a successful restart, you will start receiving 403 responses for all the requests except GET/HEAD.

        <title>403 Forbidden</title>
    <body bgcolor="white">
            <h1>403 Forbidden</h1>
        <center>nginx/1.14.0 (Ubuntu)</center>

Keep in mind,limit_except is required to be declared inside a location directive.