Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux NGINX无cookie域配置设置小问题_Linux_Cookies_Nginx_Cdn - Fatal编程技术网

Linux NGINX无cookie域配置设置小问题

Linux NGINX无cookie域配置设置小问题,linux,cookies,nginx,cdn,Linux,Cookies,Nginx,Cdn,我买了这个域名->cdnwknet.com作为我的无cookie域名。我想从它提供静态内容 我所需要做的就是正确设置它。目前,它不工作,因为我希望它的工作。我已经把图像放在这个域上,可以在这里查看->cdnwknet.com/img/index.php。我只在使用scandir显示IMG文件夹中的图像,因此图像位于该域上的该文件夹中 我试着从我的站点->调用这些图像,然后运行GTMETRIX查看它们是否作为静态图像使用,但它们并不像您在本报告->和YSLOW、CDN下看到的那样 所以我的简单问题

我买了这个域名->cdnwknet.com作为我的无cookie域名。我想从它提供静态内容

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

我试着从我的站点->调用这些图像,然后运行GTMETRIX查看它们是否作为静态图像使用,但它们并不像您在本报告->和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;
  } 
 }

致以最诚挚的问候

这与您的配置无关。内容交付网络不是一个虚拟服务器,它位于您刚刚在Name便宜网站上购买的附加域后面。这是一个基于任意广播的复杂系统,使用来自世界各地的BGP公告,并在数据中心之间同步内容


这样做的目的是通过提供来自最近地理位置的请求来提供更好的用户体验,从而避免用户在物理上距离服务器太远而导致加载时间过长的情况。如果您没有大的基础设施可以自己托管此服务,您需要从第三方购买此服务。

好的,可以将其设置为无cookie域吗?我只是想做一个简单的无cookie的域名,把我3个网站的所有图片都放在上面,然后不带cookie去拜访他们,就像我在->上拜访他们一样。出于我的需要,我不需要真正的CDN,只需要一个无cookie的域。我在谷歌上搜索了很多,测试了很多代码片段,但我还没弄明白。许多教程等在调用无cookie域并通过无cookie域重新路由静态文件时,将静态文件放在主站点上。这将非常理想。@damircalusic使用fastcgi\u pass将fastcgi\u hide\u header Set Cookie指令移动到位置。。。顺便说一句,你的手机完全坏了。谢谢@Xavier Lucas解决SSL问题,我现在已经解决了。我还将设置Coookie移到了fastcgi_pass下方。您可以查看上面编辑的版本。你的意思是这样的吗?@damircalusic是的,如果你把C的密码写对了,我觉得没问题。好的,谢谢你@Xavier Lucas。我把密码放在主配置中,而不是放在站点可用配置中。SSL现在工作得很好,我在测试实验室的成绩是A。还感谢您就cookies的主要问题提供的意见: