小编Dav*_*oma的帖子

Nginx反向代理导致504网关超时

我使用Nginx作为反向代理,接受请求,然后执行proxy_pass从端口8001上运行的上游服务器获取实际的Web应用程序.

如果我去mywebsite.com或做一个wget,我会在60秒后获得504网关超时...但是,如果我加载mywebsite.com:8001,应用程序会按预期加载!

因此有些事情阻止了Nginx与上游服务器的通信.

所有这一切都是在我的托管公司重置机器运行之后开始的,之前没有任何问题.

这是我的vhosts服务器块:

server {
    listen   80;
    server_name mywebsite.com;

    root /home/user/public_html/mywebsite.com/public;

    access_log /home/user/public_html/mywebsite.com/log/access.log upstreamlog;
    error_log /home/user/public_html/mywebsite.com/log/error.log;

    location / {
        proxy_pass http://xxx.xxx.xxx.xxx:8001;
        proxy_redirect 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;
    }
} 
Run Code Online (Sandbox Code Playgroud)

我的Nginx错误日志输出:

2014/06/27 13:10:58 [error] 31406#0: *1 upstream timed out (110: Connection timed out) while connecting to upstream, client: xxx.xx.xxx.xxx, server: mywebsite.com, request: "GET / HTTP/1.1", upstream: "http://xxx.xxx.xxx.xxx:8001/", host: "mywebsite.com"
Run Code Online (Sandbox Code Playgroud)

reverse-proxy nginx proxypass http-status-code-504

103
推荐指数
6
解决办法
16万
查看次数

移动 Safari 中的 HTML5 地理定位“权限被拒绝”错误

我正在创建一个移动网站,它使用 HTML5 地理定位请求用户点击按钮时的当前位置。这在移动 Chrome 中运行良好 - 系统会提示用户共享其当前位置,如果他们接受,程序流程将按预期继续。但是,在移动版 Safari 中,永远不会提示用户分享他们的位置,并且浏览器默认为地理位置的“PERMISSION_DENIED”错误。

就好像用户选择不分享他们的位置,尽管他们从未收到提示......

地理位置代码:

function geoLocate() {
try{
    if(navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(getUserPosition, handleGeolocateErrors);
    } else {
        alert('your browser does not support geolocation');
    }
} catch(evt) {
    alert(evt);
}

}
Run Code Online (Sandbox Code Playgroud)

错误处理:

function handleGeolocateErrors(error) {
switch(error.code) {
    case error.PERMISSION_DENIED: alert('User did not share location'); break;
    case error.POSITION_UNAVAILABLE: alert('Unable to get position'); break;
    case error.TIMEOUT: alert('Request timed out'); break;
    default: alert('An error occured'); break;
}
}
Run Code Online (Sandbox Code Playgroud)

html geolocation mobile-safari

5
推荐指数
0
解决办法
4257
查看次数