我有一个应用程序,用户可以使用 github 登录。当我登录时,应用程序挂起大约一分钟。这是日志
Started GET "/" for 177.97.171.165 at 2013-08-11 15:26:01 +0000
Started GET "/sessions/new" for 177.97.171.165 at 2013-08-11 15:26:03 +0000
Started GET "/auth/github" for 177.97.171.165 at 2013-08-11 15:27:03 +0000
(github) Request phase initiated.
Started GET "/auth/github/callback?code=ade18bb431c9303c6274&state=deaf138aff766c6ec3480a54897ae8bbbe734e0dfe11790d" for 177.97.171.165 at 2013-08-11 15:27:05 +0000
(github) Callback phase initiated.
Started GET "/" for 177.97.171.165 at 2013-08-11 15:28:06 +0000
在最后一行,我已成功登录。如果我使用 IP 而不是域名访问应用程序,则不会发生这种情况,请求不会有一分钟的延迟。有人见过这样的事情吗?
我在 ubuntu 13.04 上使用 nginx 1.4.1
我的配置
nginx.conf
user www-data;
worker_processes 1;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 30s;
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;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# 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/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
应用程序配置文件
upstream chathub { server 127.0.0.1:49153; }
server {
listen 80;
server_name chathub.us;
location / {
proxy_pass http://chathub;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
#proxy_pass_header Content-Length;
}
}
我不知道我的问题是否说清楚了...如果有人需要更多信息/文件,我可以发布它们
编辑
查找的输出
root@chathub:~# nslookup www.github.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: www.github.com
Address: 204.232.175.90
root@chathub:~# nslookup www.google.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: www.google.com
Address: 74.125.226.208
Name: www.google.com
Address: 74.125.226.210
Name: www.google.com
Address: 74.125.226.211
Name: www.google.com
Address: 74.125.226.212
Name: www.google.com
Address: 74.125.226.209