L
L
Levelleor2017-06-07 13:50:31
PHP
Levelleor, 2017-06-07 13:50:31

How to resolve the 405 (Not Allowed) error?

Initially, I used Winginx in the system directory, and when I had to move it and reinstall it, problems arose.

Most of the problems have already been fixed, but one remains. When sending a request to the /formcheck shorthand address (/formcheck.php) on the same site, a 405 (Not Allowed) error appears. As I found out it seems to be a ban on POST requests, but I did not set anything myself. In addition, before the reinstallation everything worked just perfect.

I checked and made sure that the problem is in the POST ... Everything works on the GET request, on the POST I get an error.

Can you tell me where to look for these bans and how to fix them?

nginx.conf
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        temp/nginx.pid;


events {
    worker_connections  1024;
}


http {
  server_names_hash_bucket_size 128;

    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    client_max_body_size 55m;

    #gzip  on;

  scgi_temp_path  temp/uwsgi_temp 1 2;
  uwsgi_temp_path  temp/uwsgi_temp 1 2;

  fastcgi_connect_timeout 1;


  server {
    listen   127.0.0.1:80;

    root home/localhost/public_html;
    index index.php index.html;

    log_not_found off;
        charset utf-8;

    access_log  logs/access.log  main;

    location ~ /\. {deny all;}

    location / {

      if ($host ~ ^(www\.)?([a-z0-9\-\.]+)$){
        root home/$2/public_html;
        access_log  logs/$2-access.log  main;
      }

    }

        location ~ \.php$ {

      if ($host ~ ^(www\.)?([a-z0-9\-\.]+)$){
        root home/$2/public_html;
        access_log  logs/$2-access.log  main;
      }

      if (!-e $document_root$document_uri){return 404;}
      fastcgi_pass localhost:9071;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

      include fastcgi_params;

        }
  }

  server {
    listen 127.0.0.1:443;
    include ssl.conf;

    root home/localhost/public_html;
    index index.php index.html;

    log_not_found off;
        charset utf-8;

    access_log  logs/access.log  main;

    location ~ /\. {deny all;}

    location / {

      if ($host ~ ^(www\.)?([a-z0-9\-\.]+)$){
        root home/$2/public_html;
        access_log  logs/$2-access.log  main;
      }

    }

        location ~ \.php$ {

      if ($host ~ ^(www\.)?([a-z0-9\-\.]+)$){
        root home/$2/public_html;
        access_log  logs/$2-access.log  main;
      }

      if (!-e $document_root$document_uri){return 404;}
      fastcgi_pass localhost:9071;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

      include fastcgi_params;

        }
  }


  include tools-*.conf;

  include vhosts/*.conf;

}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
champloootaku, 2017-06-07
@champloootaku

Please specify where the post-request goes?
To a third-party site or to the same.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question