2014-11-01 64 views
0

我买这个域名 - > cdnwknet.com是我的饼干免费域名。我想从中提供静态内容。NGINX饼干免费域名的配置设置小问题

所有我需要做的是正确设置它。目前它不工作,因为我希望它能够工作。我已经把图像放在可以在这里查看的域名 - > cdnwknet.com/img/index.php。我只使用scandir在IMG文件夹中显示图像,以便图像位于该域中的该文件夹中。

我测试,从我的网站调用图像 - >https://www.damircalusic.se/portfolio/,比我跑GTMETRIX,看看他们都担任静态图像,但他们没有,你可以看到此报告中 - >http://gtmetrix.com/reports/www.damircalusic.se/YGFX2COr和YSlow的下CDN。

所以我简单的问题:我如何配置的cdnwknet.com域?

我真的很感激任何帮助!

我的配置看起来像这样的时刻:

server { 
    listen 80; 
    listen [::]:80; 
    servername cdnwknet.com www.cdnwknet.com; 
    addheader Strict-Transport-Security max-age=15768000; 
    return 301 https://www.cdnwknet.com$request_uri; 
} 

server { 
    listen 443 ssl; 
    server_name cdnwknet.com; 

    ssl_certificate /etc/nginx/ssl/bundle.crt; 
    ssl_certificate_key /etc/nginx/ssl/KEY.key; 

    return 301 https://www.cdnwknet.com$request_uri; 
} 

server { 
    listen 443 ssl; 
    server_name www.cdnwknet.com; 
    root /var/www/cdnwknet.com/html; 
    index index.php index.html index.htm; 

    ssl_certificate /etc/nginx/ssl/bundle.crt; 
    ssl_certificate_key /etc/nginx/ssl/KEY.key; 

    error_page 403 /error/403.html; 
    error_page 404 /error/404.html; 

    include /etc/nginx/general-top.conf; 

    if ($request_uri ~ ^(/index\.php)$) { 
     return 301 https://www.cdnwknet.com; 
    } 

    location/{ 
     try_files $uri $uri/ =404; 

     access_log off; 
     log_not_found off; 
     expires max; 

     add_header Pragma public; 
     add_header Cache-Control "public, must-revalidate, proxy-revalidate"; 

     tcp_nodelay off; 
     break; 
    } 

    location ~ \.php$ { 
     try_files $uri =404; 
     fastcgi_split_path_info ^(.+\.php)(/.+)$; 
     fastcgi_pass unix:/var/run/php5-fpm.sock; 
     fastcgi_hide_header Set-Cookie; 
     fastcgi_ignore_headers Set-Cookie; 
     fastcgi_index index.php; 
     include fastcgi_params; 
    } 

    location = /error/403.html { 
     root /var/www/cdnwknet.com/html; 
     allow all; 
    } 

    location = /error/404.html { 
     root /var/www/cdnwknet.com/html; 
     allow all; 
    } 
} 

问候

回答

0

它无关,与你的配置。 A C含义D elivery 网络不是您在Namecheap上购买的其他域名后的虚拟服务器。这是一个基于Anycast的复杂系统,它使用来自世界多个地点的BGP公告并在数据中心之间同步内容。

这样做的目的是通过服务从最近的地理位置,就可能请求提供更好的用户体验,为用户身体太远离你的服务器遭受这样高负荷的时间来摆脱过度的往返时间。如果您没有可供您自己托管的(大)基础架构,则需要从第三方购买此服务。

+0

好的,是否有可能使它成为免费的cookie?我只是想制作一个简单的免费域名,并为我的3个网站提供所有图片,并且只需打电话给他们,就像我正在打电话给他们 - > https://www.damircalusic.se/portfolio /。 为了我的需要,我不需要一个真正的CDN只是一个cookie的免费域名。我搜索了很多,并测试了很多代码片段,但是我还没弄明白。 许多教程等在其主站点上都有静态文件remian,同时调用cookie免费域,并通过cookie免费域重新路由静态。这将是理想的。 – damircalusic 2014-11-02 01:38:02

+0

@damircalusic使用'fastcgi_pass' ...顺便说一下你的[**密码套件**]移动'fastcgi_hide_header设置Cookie'指令位置(http://serverfault.com/questions/637848/how-to-mitigate -poodle-but-keep-sslv3-support-for-old-clients)完全破坏。 – 2014-11-02 11:33:57

+0

谢谢@Xavier卢卡斯SSL问题,我现在已经修复它。我也已经将FastCgi_pass下的Set-Coookie移动了。你可以看看上面编辑过的版本。这是你的意思吗? – damircalusic 2014-11-03 18:52:17