我正在使用Nginx反向代理,以便当访问者查看example.com时,他们实际上正在查看example.com:8888。以前它工作正常但突然今天早上它无法通过域访问,但仍然可以使用端口8888的IP地址访问。
所以我怀疑问题是由Nginx引起的,当我查看日志时发现多行显示upstream timed out
错误,我发现上游IP地址是Cloudflare的IP(我指出了我的域到Cloudflare)。
我不确定为什么突然之间无法访问它。有人能帮忙吗?谢谢。这是错误日志:
2017/07/17 07:53:41 [error] 25707#25707: *31 no live upstreams while connecting to upstream, client: [MY IP], server: www.example.com$, request: "GET / HTTP/1.1", upstream: "http://www.example.com/", host: "www.example.com"
2017/07/17 07:53:41 [error] 25707#25707: *33 upstream timed out (110: Connection timed out) while connecting to upstream, client: [MY IP], server: www.example.com$, request: "GET / HTTP/1.1", upstream: "http://104.18.51.97:8888/", host: "www.example.com"
这是Nginx配置:
server {
listen 80;
server_name example.com;
return 301 http://www.example.com$request_uri;
}
server {
listen 80 default_server;
server_name ~^(?<subdomain>.+)\.example\.com$;
location / {
proxy_pass http://www.example.com:8888;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $subdomain.example.com;
proxy_cache_bypass $http_upgrade;
}
}