我有一个wordpress站点,其配置如下:
ian@ianhobson:/etc/nginx/sites-enabled$ cat thecoachmasternetwork
# Statements for thecoachmasternetwork.com
#
# rewrites of http to https at bottom of file
server {
server_name thecoachmasternetwork.com www.thecoachmasternetwork.com;
listen 80;
fastcgi_read_timeout 300;
root /var/www/thecoachmasternetwork/htsecure;
index index.php;
fastcgi_index index.php;
access_log /var/log/nginx/thecoachmasternetwork.access.log;
# error_log /var/log/nginx/error.log;
#
location = /favicon.ico {
log_not_found off;
access_log off;
}
location ~ \.user\.ini$ {
deny all;
}
# disallow hot linking to images
location ~ .(gif|png|jpg|jpeg)$ {
valid_referers none blocked thecoachmasternetwork.com www.thecoachmasternetwork.com;
if ($invalid_referer) {
return 403;
}
}
# serve static files that exist
location / {
try_files $uri $uri/ /index.php?$args;
}
# send .php files to fastcgi if file exists
location ~ \.php$ {
# Zero-day exploit defence - http://forum.nginx.org/read.php?2,88845,page=3
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root@fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include /etc/nginx/fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}
}
# redirects from http -> https
#server {
# if ($host = www.thecoachmasternetwork.com) {
# return 301 https://$host$request_uri;
# } # managed by Certbot
# if ($host = thecoachmasternetwork.com) {
# return 301 https://$host$request_uri;
# } # managed by Certbot
# server_name thecoachmasternetwork.com www.thecoachmasternetwork.com;
# listen 80;
# return 404; # managed by Certbot
#}
ian@ianhobson:/etc/nginx/sites-enabled$我找不到重写或返回301。
但是,当我请求根目录或请求/index.php时,访问日志显示一个301重定向到服务器上的另一个站点。这不是default_site,也不是第一个站点。在包含启用/*站点之前,已经在nginx.conf中设置了这些站点。不过,仅在80端口。
我怀疑certbot的证书存在问题(这就是为什么我已经将它切换到端口80,soI可以再次启动它们)。重定向到的站点,在https上,并且看起来很好。
其他可能有用的信息。正确地为/license.txt服务。包含.php 的文件将产生预期的结果。我看不出里面有什么奇怪的东西。我在WP文件中到处找过,没有什么奇怪的地方,但它是一个非常复杂的网站。
error.log里什么都没有。
那么到底发生了什么?
发布于 2022-06-23 10:31:45
原来wordpress在“选项”表中有两行,它们定义了站点和主页的URL。我没有改变这些,是wordpress发布的301。
https://stackoverflow.com/questions/72717250
复制相似问题