我们已经在Ubuntu Trusty上运行了nginx。它通过一个IP地址上的https服务多个网站。
随机地,尽管它似乎与工作量有些关系,但有时单个请求会出现在错误的虚拟主机上。这导致要求lustrum.thalia.nu
由服务,thalia.nu
反之亦然。然后,当用户突然进入另一个网站时,这将产生令人讨厌的错误页面。按时F5,用户将再次回到原始目标。
似乎与浏览器或操作系统无关。已经确认它会在Firefox(Linux,Windows,Mac),Edge(Windows)和Chrome(Linux,Windows,Android)和Safari(iOS)上发生。
当系统处于负载状态时,此问题似乎更经常发生,这表明存在某种竞争状况。
芦荟
server {
server_name lustrum.thalia.nu;
listen 443 ssl;
ssl on;
ssl_certificate /etc/nginx/certs/lustrum.thalia.nu.crt;
ssl_certificate_key /etc/nginx/certs/lustrum.thalia.nu.key;
add_header Strict-Transport-Security "max-age=63072000; preload";
root /var/www/thalia-lustrum/public_html;
location / {
index index.php;
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# Pass all .php files onto a php-fpm/php-fcgi server.
location ~ [^/]\.php(/|$) {
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass unix:/var/run/php5-fpm-thalia-lustrum.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /public_html$fastcgi_script_name;
}
}
塔利亚
server {
server_name thalia.nu;
listen 443 ssl;
ssl on;
ssl_certificate /etc/nginx/certs/www.thalia.nu.crt;
ssl_certificate_key /etc/nginx/certs/www.thalia.nu.key;
add_header Strict-Transport-Security "max-age=63072000; preload";
root /var/www/thalia/public_html;
location / {
try_files $uri $uri/ /index.php/$request_uri;
index index.php index.html index.htm;
}
location ~ \.php($|/) {
include /etc/nginx/fastcgi_params;
set $script $uri;
set $path_info "";
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
}
fastcgi_read_timeout 120;
fastcgi_pass unix:/var/run/php5-fpm-thalia-www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /public_html$fastcgi_script_name;
}
}
如您所见,我们为这两个域运行不同的PHP5-FPM池。这些池被chroot到不同的文件夹,并以不同的用户身份运行。据我所知,PHP-FPM的配置相当标准。
我们已经尝试了nginx 1.4.6-ubuntu3和nginx 1.8.0-1 + trusty。
对数遥测
266.266.266.266 - - [25/Nov/2015:09:24:40 +0100] "GET /committees/175 HTTP/1.1" 302 5 "https://thalia.nu/committees" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0" Host: "thalia.nu" Location: "https://thalia.nu/index.php//committees/wp-admin/setup-config.php"
在这一行中,您可以看到对该页面的请求/committees
突然重定向到wp-admin
。看来,请求/committees
已由thalia-lustrum
PHP-fpm池处理...
DNS区域文件
我们看不到这可能如何相关,但是...
;; MX Records
thalia.nu. 300 IN MX 20 relay.transip.nl.
thalia.nu. 300 IN MX 10 ivo.thalia.nu.
;; TXT Records
thalia.nu. 300 IN TXT "v=spf1 a mx a:mulgore.hexon-is.nl a:moonray.hexon-is.nl a:fred.thalia.nu a:ivo.thalia.nu ~all"
;; SPF Records (Sender Policy Framework)
thalia.nu. 300 IN SPF "v=spf1 a mx a:mulgore.hexon-is.nl a:moonray.hexon-is.nl a:fred.thalia.nu a:ivo.thalia.nu ~all"
;; CNAME Records
lustrum.thalia.nu. 300 IN CNAME thalia.nu.
;; A Records (IPv4 addresses)
thalia.nu. 300 IN A 131.174.31.8
www.thalia.nu. 300 IN A 131.174.31.8
ivo.thalia.nu. 300 IN A 131.174.31.8
Host:
http标头和用户代理的内容添加到日志文件中吗?有关详情,请参见此处:serverfault.com/questions/636790/…。实际上,我尝试向您的网站提出一些要求,但不会重现您的问题。您正在使用哪个客户端来重现此内容?
config.php
找不到的简短错误。