M
M
Minusator2018-03-16 11:38:30
Nginx
Minusator, 2018-03-16 11:38:30

How to make admin-ajax nginx wordpress work correctly?

Greetings friends.
There is Wordpress 4.9.4 on a centos 7 server, HTTPS. The site works fronted ajax authorization, registration. If the http server is apache, then the authorization form works correctly. If I change to fastcgi nginx + php-fpm, the form doesn't make the transition. Although if the page is reloaded, then the profile is included.
As a result, I get an error admin-ajax.php 400 Bad Request.
Config domain.ru.conf nginx

server {
  server_name домен.ru www.домен.ru;
  charset UTF-8;
  index index.html index.php;
  disable_symlinks if_not_owner from=$root_path;
  include /etc/nginx/vhosts-includes/*.conf;
  include /etc/nginx/vhosts-resources/домен.ru/*.conf;
  access_log /var/www/httpd-logs/домен.ru.access.log;
  error_log /var/www/httpd-logs/домен.ru.error.log notice;
  set $root_path /var/www/user/data/www/домен.ru;
  root $root_path;
  listen 11.111.11.111:80;
  location / {
    location ~ [^/]\.ph(p\d*|tml)$ {
      
      try_files /does_not_exists @php;
      
    }
    location / {
                try_files $uri $uri/ /index.php?$args;
                
      
        }
}
  gzip on;
  gzip_comp_level 7;
  gzip_disable "msie6";
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
  expires 24h;
  location @php {
    fastcgi_index index.php;
    fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]домен.ru";
    fastcgi_pass unix:/var/www/php-fpm/user.sock;
    fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
    try_files $uri =404;
    include fastcgi_params;
  }
}
server {
  server_name домен.ru www.домен.ru;
  ssl on;
  ssl_certificate "/var/www/httpd-cert/user/домен.ru_le1.crtca";
  ssl_certificate_key "/var/www/httpd-cert/user/домен.ru_le1.key";
  ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:!NULL:!RC4;
  ssl_prefer_server_ciphers on;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  add_header Strict-Transport-Security "max-age=31536000;";
  ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
  charset UTF-8;
  index index.html index.php;
  disable_symlinks if_not_owner from=$root_path;
  include /etc/nginx/vhosts-includes/*.conf;
  include /etc/nginx/vhosts-resources/домен.ru/*.conf;
  access_log /var/www/httpd-logs/домен.ru.access.log;
  error_log /var/www/httpd-logs/домен.ru.error.log notice;
  set $root_path /var/www/user/data/www/домен.ru;
  root $root_path;
  listen 11.111.11.111:443;
  gzip on;
  gzip_comp_level 7;
  gzip_disable "msie6";
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
  location / {
    location ~ [^/]\.ph(p\d*|tml)$ {
      try_files /does_not_exists @php;
    }
    location / {
                try_files $uri $uri/ /index.php?$args;
               
        }
  }
  expires 24h;
  location @php {
    fastcgi_index index.php;
    fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]домен.ru";
    fastcgi_pass unix:/var/www/php-fpm/user.sock;
    fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
    try_files $uri =404;
    include fastcgi_params;
  }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question