繁体   English   中英

NGINX Cookie免费域配置设置小问题

[英]NGINX cookie free domain config setup small issue

我已购买此域名-> cdnwknet.com成为我的免费cookie域名。 我想从中提供静态内容。

我需要做的就是正确设置它。 目前,它不起作用,我希望它能起作用。 我将图像放在该域中,可以在这里查看-> 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;
  } 
 }

最好的祝福

它与您的配置无关。 A C ontent d elivery 网络是不是在你身后刚买Namecheap其他域的虚拟服务器。 这是一个基于任意播的复杂系统,它使用来自世界各地的BGP公告并在数据中心之间同步内容。

此操作的目的是通过服务来自最接近地理位置的请求来提供更好的用户体验,从而避免用户离服务器太远的往返时间过长,从而导致加载时间过长。 如果您没有可供自己托管的(大型)基础架构,则需要从第三方处获得此服务。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM