【发布时间】:2021-09-05 08:22:07
【问题描述】:
即使在解决了这里提出的所有 nginx + WordPress 永久链接问题之后,也卡住了。
我在子目录digitext-v1 中安装了 WordPress。根目录只有phpinfo文件。
root --> /var/www
subdirectory --> /var/www/digitext-v1
普通的永久链接适用于主页和所有页面。漂亮的永久链接适用于主页,但其他所有链接都会出现 404 错误。
我的 conf 文件如下所示。与我的实时 Nginx 服务器具有几乎相同的设置(服务器名称中使用的 fqdn 除外),其中漂亮的永久链接工作得非常好。
你能在我失去理智之前帮我解决这个问题吗?跟域名有关系吗?我做错了什么??
server {
listen 80;
server_name digitextv1 192.168.11.8;
root /var/www/digitext-v1;
index index.php index.html index.htm;
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location / {
# Setting pretty permalinks in WordPress
# First attempt to serve request as file ($uri)
# or directory ($uri/).
try_files $uri $uri/ /index.php?$args;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
编辑(错误日志中的几行)
2021/08/31 16:05:48 [error] 3185#3185: *1406 FastCGI sent in stderr: "PHP message: PHP Warning: preg_match() expects parameter 2 to be string, array given in /var/www/digitext-v1/wp-content/plugins/popup-maker/includes/functions/popups/template.php on line 106PHP message: PHP Warning: preg_match() expects parameter 2 to be string, array given in /var/www/digitext-v1/wp-content/plugins/popup-maker/includes/functions/popups/template.php on line 106" while reading upstream, client: 192.168.11.41, server: 192.168.11.8, request: "GET /digitext-v1/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.11.8", referrer: "http://192.168.11.8/digitext-v1/wp-admin/options-permalink.php"
2021/08/31 16:06:28 [error] 3185#3185: *1426 FastCGI sent in stderr: "PHP message: PHP Warning: preg_match() expects parameter 2 to be string, array given in /var/www/digitext-v1/wp-content/plugins/popup-maker/includes/functions/popups/template.php on line 106" while reading upstream, client: 192.168.11.41, server: 192.168.11.8, request: "GET /digitext-v1/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.11.8"
2021/08/31 16:06:28 [error] 3185#3185: *1426 FastCGI sent in stderr: "PHP message: PHP Warning: preg_match() expects parameter 2 to be string, array given in /var/www/digitext-v1/wp-content/plugins/popup-maker/includes/functions/popups/template.php on line 106PHP message: PHP Warning: preg_match() expects parameter 2 to be string, array given in /var/www/digitext-v1/wp-content/plugins/popup-maker/includes/functions/popups/template.php on line 106" while reading upstream, client: 192.168.11.41, server: 192.168.11.8, request: "GET /digitext-v1/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.11.8"
2021/08/31 16:09:59 [error] 3185#3185: *1438 FastCGI sent in stderr: "PHP message: PHP Warning: preg_match() expects parameter 2 to be string, array given in /var/www/digitext-v1/wp-content/plugins/popup-maker/includes/functions/popups/template.php on line 106" while reading upstream, client: 192.168.11.41, server: 192.168.11.8, request: "GET /digitext-v1/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.11.8", referrer: "http://192.168.11.8/digitext-v1/wp-admin/options-permalink.php"
2021/08/31 16:09:59 [error] 3185#3185: *1438 FastCGI sent in stderr: "PHP message: PHP Warning: preg_match() expects parameter 2 to be string, array given in /var/www/digitext-v1/wp-content/plugins/popup-maker/includes/functions/popups/template.php on line 106PHP message: PHP Warning: preg_match() expects parameter 2 to be string, array given in /var/www/digitext-v1/wp-content/plugins/popup-maker/includes/functions/popups/template.php on line 106" while reading upstream, client: 192.168.11.41, server: 192.168.11.8, request: "GET /digitext-v1/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.11.8", referrer: "http://192.168.11.8/digitext-v1/wp-admin/options-permalink.php"
【问题讨论】:
-
您是否重置了浏览器缓存。我看不出你的配置有什么问题。显示这些 404 响应之一的访问日志和错误日志条目。
-
清除缓存,尝试私人/隐身浏览器会话。在 server_name 中使用非 FQDN 会导致它吗?我在错误日志中看不到任何 404 响应(在问题中添加)。
-
您的 php 位置配置中有一个 try_files。
-
已经尝试从 php 位置删除 try_files。不能解决问题。
标签: wordpress nginx permalinks