【发布时间】:2014-11-04 02:55:42
【问题描述】:
我已经购买了这个域 --> 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;
}
}
最好的问候
【问题讨论】: