我正在自我托管一堆服务,这些服务托管在各种am /容器中,并且使用Caddy v1服务器作为反向代理,通过不同的子域访问它们。
最近,我启动了几个Wordpress站点,它们托管在一个单独的VM上,其中包含一个Nginx服务器和单独的站点--为每个站点启用了信任,但是使用了一个共享的Mariadb实例和惟一的WP表前缀。
首先,我在主域的一个子域上托管了其中一个站点,我们称之为apple.orange.com,它可以很好地使用来自卡迪的自动电子证书。我为它获得了一个专用域,比如apple.com,并试图将c彩配置更改为:
我还更改了nginx服务器上该站点的启用站点配置,将server_name更改为apple.com。
这就是我开始遇到我没想到的问题的地方。当我试图转到apple.com时,我开始得到太多的重定向,发现apple.com重定向到apple.orange.com (这很奇怪),而apple.orange.com正像预期的那样重定向到apple.com,创建了一个循环。
我将我的Caddyfile更改为代理apple.orange.com到nginx,并添加了一个站点配置,以在orange.apple.com和apple.com上提供相同的文件,以使站点恢复正常。
从那以后,我一直无法让apple.com停止重定向到orange.apple.com。
我试过:
所以我在这里,经过了3天的愤怒,完全被所发生的事情搞糊涂了。如果您对如何调试此程序有任何见解,将不胜感激。
下面是一堆相关的文件/信息:
卡迪文件
# a bunch of other subdomains exist in the same file, but I also tried with just this.
apple.com, www.apple.com {
proxy / 10.0.1.108 {
transparent
}
}
apple.orange.com
proxy / 10.0.1.108 {
transparent
}
}/etc/nginx/sites启用/apple.com
server {
listen 80;
listen [::]:80;
root /var/www/html/apple.com;
index index.php index.html index.htm;
server_name apple.com www.apple.com *.apple.com apple.orange.com;
client_max_body_size 100M;
autoindex off;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}/etc/nginx/nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# Compression level (1-9)
gzip_comp_level 5;
# Don't compress anything under 256 bytes
gzip_min_length 256;
# Compress output of these MIME-types
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/x-font-opentype
application/x-font-truetype
application/x-javascript
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/eot
font/opentype
font/otf
image/svg+xml
image/x-icon
image/vnd.microsoft.icon
text/css
text/plain
text/javascript
text/x-component;
# Disable gzip for bad browsers
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}显然,apple.com不是我的,orange.com也不是。尽管如此,请告诉我实际的域是否相关(如果这是DNS问题,我对此表示怀疑,因为请求正在向我的IP发出)。
提前感谢您的帮助!
发布于 2020-06-07 04:44:33
因此,我在搜索到一个wordpress站点到一个新域名时,随机搜索后,我发现了问题所在。显然,这并不像将域指向nginx站点那么简单,wordpress安装有一个需要知道网站的服务地点站点URL字段。
所以重定向不是来自卡迪,他们不是来自Nginx,他们来自实际wordpress网站。
https://stackoverflow.com/questions/62230551
复制相似问题