Hallo zusammen,
ich bin gerade am experimentieren mit einer nginx-conf für ein contao.
Caching in contao ist aktiviert.
Ich kriege aber immer noch ein Contao-Cache: miss
Code:
? ~ curl -sS -D - http:/test.test.de/ -o /dev/null
HTTP/1.1 200 OK
Server: nginx/1.17.6
Content-Type: text/html; charset=utf-8
Content-Length: 30421
Connection: keep-alive
Vary: Accept-Encoding
Date: Mon, 18 Jan 2021 13:51:47 GMT
Cache-Control: max-age=900, private
Vary: Origin
Vary: Cookie
x-powered-by: PHP/7.3.19
X-Content-Type-Options: nosniff
Referrer-Policy: no-referrer-when-downgrade, strict-origin-when-cross-origin
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Contao-Private-Response-Reason: authorization
Contao-Cache: miss
Age: 0
und pingdom sagt mir, ich solle "Add Expires headers", wobei ich dachte ich hätte das getan.
die nginx.conf sieht mittlerweile so aus:
Code:
pagespeed off;
}
location /system/modules/catalog-manager/assets/awesomplete {
alias /var/www/clients/client3/web285/web/v1/system/modules/catalog-manager/assets/awesomplete/;
}
location /system/modules/catalog-manager/assets {
alias /var/www/clients/client3/web285/web/v1/system/modules/catalog-manager/assets/;
}
# - Web-Path zusätzlich anpassen/uebergeordnetes Verzeichnis hinzufuegen (PHP open_basedir:)
# - Rechte fuer uebergeordnetes Verzeichnis anpassen
# - PHP Optionen fuer Phar setzen
location / {
client_max_body_size 100M;
index app.php;
try_files $uri $uri/ /app.php$is_args$args;
location ~ ^/(app|app_dev|config|install|preview|contao-manager\.phar)\.php(/|$) {
include /etc/nginx/fastcgi_params;
{FASTCGIPASS}
#fastcgi_pass unix:/var/lib/php7.2-fpm/web41.sock;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_temp_file_write_size 10m;
fastcgi_busy_buffers_size 512k;
fastcgi_buffer_size 512k;
fastcgi_buffers 16 512k;
fastcgi_read_timeout 1200;
fastcgi_param HTTP_AUTHORIZATION $http_authorization;
}
}
## Directives to send expires headers and turn off 404 error logging.
#location ~* #^.+\.(eot|otf|woff|woff2|ttf|rss|atom|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|webp|png)$ {
# expires max;
#}
## CSS and Javascript send expires headers.
#location ~* \.(?:css|js)$ {
# expires 1y;
#}
}
###added Jan 2021
location ~* \.(?:eot|woff|woff2|ttf|svg|otf) {
expires 31536000s;
etag on;
if_modified_since exact;
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public";
# allow CORS requests
add_header Access-Control-Allow-Origin *;
types {font/opentype otf;}
types {application/vnd.ms-fontobject eot;}
types {font/truetype ttf;}
types {application/font-woff woff;}
types {font/x-woff woff2;}
}
location ~* \.(?:jwebp|pg|jpeg|gif|png|ico|xml)$ {
expires 365d
etag on;
if_modified_since exact;
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public";
}
location ~* \.(?:css|js)$ {
access_log off;
log_not_found off;
add_header Cache-Control "no-cache, public, must-revalidate, proxy-revalidate";
}
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
gzip on;
gzip_disable "msie6";
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js image/svg+xml;
gzip_buffers 16 8k;
Viele Grüße,
conter
Lesezeichen