我有一个相当令人困惑的问题,它只影响我的三个nginx
反向代理服务器中的一个。我定义了一个conf
包含三个虚拟服务器的文件,如下所示:
# Django
upstream tickets {
server 10.11.12.10;
}
server {
listen 107.181.80.13:80;
#listen 107.181.80.13:443 ssl;
#ssl_certificate /etc/nginx/ssl/SL.AQTS.COM_SSL.crt;
#ssl_certificate_key /etc/nginx/ssl/SL.AQTS.COM_SSL.key;
server_name members.aqtsolutions.com;
location / {
proxy_pass http://tickets;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
# Wordpress (Linux)
upstream wp_server {
server 10.11.12.9;
}
server {
listen 107.181.80.13:80;
server_name ubnt.aqtsolutions.com;
#rewrite ^/wordpress/(.*)$ /$1 last;
location / {
proxy_pass http://wp_server;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
#proxy_cookie_path /wordpress/ /;
#sub_filter /wordpress/ /;
#access_log off;
}
}
# Wordpress (Windows)
upstream wp_server_office {
server 50.247.86.20;
}
server {
listen 107.181.80.13:80;
server_name aqtsolutions.com www.aqtsolutions.com;
#rewrite ^/wordpress/(.*)$ /$1 last;
location / {
proxy_pass http://wp_server_office;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
#proxy_cookie_path /wordpress/ /;
#sub_filter /wordpress/ /;
#access_log off;
}
}
但我只能访问members.aqtsolutions.com
(Django)和www.aqtsolutions.com/aqtsolutions.com
(Wordpress(Windows))。 ubnt.aqtsolutions.com
返回“未找到服务器”。
就像我之前说过的,这似乎只影响我的一个反向代理,我的其他代理(在.org
和.net
域上)可以很好地为 2 个以上的虚拟服务器提供服务。
答案1
浏览器中显示“未找到服务器”通常表示无法将主机名解析为 IP 地址。
我注意到ubnt.aqtsolutions.com无法解析,但其他两个名称可以解析。
您的 nginx 配置可能很好,只是缺少 DNS 条目。
答案2
可能是因为你没有Aubnt.aqtsolutions.com 的 DNS 记录
nslookup ubnt.aqtsolutions.com 8.8.8.8
Server: 8.8.8.8
Address: 8.8.8.8#53
** server can't find ubnt.aqtsolutions.com: NXDOMAIN