Я уже некоторое время успешно использую WordPress 5.4 на Nginx, но недавно столкнулся с постоянной проблемой при создании нового пользователя, который направляет меня на страницу 404 not found, без ошибок в файле журнала.
Я запускаю Nginx на ubuntu 18, который запускается на экземпляре виртуальной машины на GC, моя конфигурация серверного блока выглядит следующим образом:
fastcgi_cache_path /home/usr/example.com/cache levels=1:2 keys_zone=phpcache:100m max_size=10g inactive=60m use_temp_path=off;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
server {
listen [::]:80;
listen 80;
server_name example.com www.example.com;
return 301 https://www.example.com$request_uri;
}
server {
listen [::]:443 ssl http2;
listen 443 ssl http2;
server_name example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
add_header Strict-Transport-Security "max-age=15762000; preload" always;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem; # managed by Certbot
ssl_stapling on; # managed by Certbot
ssl_stapling_verify on; # managed by Certbot;
return 301 https://www.example.com$request_uri;
}
server {
listen [::]:443 ssl http2;
listen 443 ssl http2;
server_name www.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
add_header Content-Security-Policy upgrade-insecure-requests;
add_header Strict-Transport-Security "max-age=15762000; preload" always;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem; # managed by Certbot
ssl_stapling on; # managed by Certbot
ssl_stapling_verify on; # managed by Certbot;
error_log /home/usr/example.com/logs/error.log;
root /home/usr/example.com/public/;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location = /50x.html {
root /usr/share/nginx/html;
}
set $skip_cache 0;
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != "") {
set $skip_cache 1;
}
# Don't cache uris containing the following segments
if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|^/feed/*|/tag/.*/feed/*|index.php|/.*sitemap.*\.(xml|xsl)") {
set $skip_cache 1;
}
# Don't cache booking page
if ($request_uri = "/bookings/") {
set $skip_cache 1;
}
# Don't use the cache for logged in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
set $skip_cache 1;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_pass php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_cache phpcache;
fastcgi_cache_valid 200 301 302 60m;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache_min_uses 1;
fastcgi_cache_lock on;
add_header X-FastCGI-Cache $upstream_cache_status;
}
location ~ /purge(/.*) {
fastcgi_cache_purge phpcache "$scheme$request_method$host$1";
}
#enable gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1000;
gzip_comp_level 5;
gzip_types application/json text/css application/x-javascript application/javascript image/svg+xml;
gzip_proxied any;
# A long browser cache lifetime can speed up repeat visits to your page
location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
expires max;
access_log off;
log_not_found off;
}
# disable access to hidden files
location ~ /\.ht {
access_log off;
log_not_found off;
deny all;
}
}
в журналах доступа указано следующее
[11/May/2020:10:47:56 +0000] "POST /wp-admin/admin-ajax.php HTTP/2.0" 200 67 "https://www.example.com/wp-admin/index.$
[11/May/2020:10:49:56 +0000] "POST /wp-admin/admin-ajax.php HTTP/2.0" 200 67 "https://www.example.com/wp-admin/index.$
[11/May/2020:10:53:15 +0000] "POST /wp-admin/admin-ajax.php HTTP/2.0" 200 67 "https://www.example.com/wp-admin/index.$
[11/May/2020:10:53:29 +0000] "GET /wp-admin/user-new.php HTTP/2.0" 200 28940 "https://www.example.com/wp-admin/index.$
[11/May/2020:10:53:53 +0000] "POST /wp-admin/user-new.php HTTP/2.0" 404 162 "https://www.example.com/wp-admin/user-ne$
[11/May/2020:10:54:07 +0000] "GET /wp-admin/index.php HTTP/2.0" 200 26640 "https://www.example.com/wp-admin/user-new.$
[11/May/2020:10:54:07 +0000] "GET /wp-json/yoast/v1/statistics HTTP/2.0" 200 272 "https://www.example.com/wp-admin/in$
[11/May/2020:10:54:07 +0000] "POST /wp-admin/admin-ajax.php HTTP/2.0" 200 36 "https://www.example.com/wp-admin/index.$
[11/May/2020:10:54:07 +0000] "POST /wp-admin/admin-ajax.php HTTP/2.0" 200 36 "https://www.example.com/wp-admin/index.$
[11/May/2020:10:54:08 +0000] "POST /wp-admin/admin-ajax.php HTTP/2.0" 200 335 "https://www.example.com/wp-admin/index$
Очень признателен за помощь, спасибо.