我正在使用以下Nginx配置,除了Android设备外,每个设备都能正常运行。从Android设备连接通常以Chrome浏览器和Android应用程序的超时连接结束。我有Nexus 6,服务器托管在Amazon EC2上。
我在WiFi上,同一个WiFi网络上的所有其他设备都可以正常工作。
upstream serverName {
server localhost:8080;
}
upstream serverName2 {
server serverName2.companyName.co:19001;
}
server {
listen 80 default;
server_name localhost api.companyName.co;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl spdy;
server_name localhost companyName.co;
ssl on;
ssl_certificate /etc/nginx/ssl/crt_file.crt;
ssl_certificate_key /etc/nginx/ssl/key_file.key;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/ssl/ca-certs.pem;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block";
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
location / {
return 302 /api;
}
location /api {
include snippets/proxy_pass.conf;
proxy_pass http://serverName;
proxy_send_timeout 15;
proxy_read_timeout 20;
}
location = /api/documents {
include snippets/proxy_pass.conf;
proxy_pass http://serverName;
proxy_read_timeout 180s;
proxy_send_timeout 300s;
client_max_body_size 100M;
}
location = /ws-comm {
include snippets/proxy_pass.conf;
proxy_pass http://serverName2;
proxy_send_timeout 7d;
proxy_read_timeout 7d;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}