我正在使用Cloudflare CNAME展平和Cloudflare页面规则来加速我的网站,这也是Nginx代理服务器的背后。我遇到了无限重定向循环并尝试调试。
我正在努力完成以下事项(并且希望尽可能多地依赖Cloudflare的速度)
启用完整SSL,因为我在Nginx上设置了443
我的根记录设置为我的www.domain.com记录的别名
我已经为根和www记录启用了Cloudflare按钮,但我不断获得无限重定向循环。当我禁用www记录的按钮时,一切正常。但是,我没有获得任何cloudflare缓存优势。
我的nginx配置如下:
enter code here
server {
listen [::]:80;
listen 80;
server_name *.domain.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
return 301 https://$host:443$request_uri;
}
server {
listen [::]:443 ssl spdy;
listen 443 ssl spdy;
server_name *.domain.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
ssl_certificate /tls/server.crt;
ssl_certificate_key /tls/server.key;
keepalive_timeout 70;
add_header Alternate-Protocol 443:npn-spdy/2;
location / {
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml;
gzip_vary on;
gzip_comp_level 6;
proxy_pass http://app;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Request-Start $msec;
}
}
upstream app {
server 172.17.0.11:5000;
}
我应该如何高效(快速)地做我想做的事情?
答案 0 :(得分:0)