August 14, 2019 03:34PM
I have configured nginx to cache static content, but i cant see any file in caching folder, also when i'm opening page in DevTool on network tab it show me:
Response Header:
access-control-allow-credentials: true
access-control-allow-methods: GET
access-control-allow-origin: http://google.com
cache-control: no-cache, private
cf-ray: 50655a0c2cf0d413-BUD
content-encoding: br
content-type: text/html; charset=UTF-8
date: Wed, 14 Aug 2019 19:31:55 GMT
expect-ct: max-age=604800

set-cookie: XSRF-TOKEN=eyJpdiI6ImdoMmRFbmFnTldMSUUrYUlJZm1LWmc9PSIsInZhbHVlIjoiUkY1akJlK0FHRktnYkZMeFVxRXA5dnZHSXlwTTlrdlwvVHhvMkpHcFlUbTBab0xYaEpCbm1RVmdEQWNVT0NKdVwvIiwibWFjIjoiZDliYWI2NjQ1MTliOGZkZTA1OWU4OTlkYTFlYjBlY2ExYmI5NjQ0OGI0YjVkMDFiMmI0ODUzOWYxMGI5MTUwZCJ9; expires=Wed, 14-Aug-2019 21:31:54 GMT; Max-Age=7200; path=/
set-cookie: watchbox_session=(heregoesmycookies); expires=Wed, 14-Aug-2019 21:31:54 GMT; Max-Age=7200; path=/; httponly
status: 200
vary: Accept-Encoding

Request Header:
:authority: watchbox.ge
:method: GET
:path: /
:scheme: https
accept: image/webp,image/apng,image/*,*/*;q=0.8
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
cache-control: no-cache
cookie: __cfduid=dfbc73480dfead53f4eabc68bb277065c1565737966; remember_web_59ba36addc2b2f9401580f014c7f58ea4e30989d=eyJpdiI6IjE3cGJtVGk3RkY2NGU0cVJwOXhsa0E9PSIsInZhbHVlIjoiZDJYUm1TRVlXZHpKd0t0Znh1UFYxVmpRWmJJMm8wRzVFVVwvMzlrcHdSXC9QNVkxd2NOWklZcWJvOElCRHpHVDQ3YjVcL1Q2alIxMjhqeHY5emJIV2pcL0txMGFPMW5pK1JpVTB1cjN0eGdhaEdscjZIN1JodDluNXAyV1JsbUhZUHIwU3lsUFpEUzE1VlFZZ0NrVFEya3hTRVREcjJmdHRvU3JSUFo5ZlQ1NjgxVT0iLCJtYWMiOiI3MzBjMjQzYjgwMjlmMzY2ZTI4NDdhYTgzOTE1YWVlYjc5OTAwN2ViODIxM2NmZTRmY2RiODIyYTMzYjJjYWMxIn0%3D; XSRF-TOKEN=eyJpdiI6IiswV0VGeThJdmlySHV5TzZ1MTF6XC9RPT0iLCJ2YWx1ZSI6Ik9xdzFjOTlKczhTamlVbExkdEJqeVFvRExTcVdMRlZVaXpoM3ppY0tWb0pWUHRzOWJ5ZlhHTlF5VnRcL05HRTZsIiwibWFjIjoiM2VhYTAyYjBjNjFkYzkyYjEzOWE4NTEzMTQyZDQyMWMxMTY2MzJkMjQ4ZTc5MjljZTI4ZTNmODg4NzZjNmE2ZiJ9; watchbox_session=(heregoesmysession)
pragma: no-cache
referer: https://watchbox.ge/
user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36


My nginx configuration:


ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;

proxy_cache_path /etc/nginx/cached_content levels=1:2 keys_zone=watchbox_cache:10m max_size=4g
inactive=24h;

server {
listen 80;
listen [::]:80;

server_name 46.101.166.170;

# Redirect all traffic comming from your-server-ip to your domain
return 301 $scheme://watchbox.ge;
}

server {
listen 80;

server_name www.watchbox.ge watchbox.ge;
return 301 https://watchbox.ge$request_uri; #redirect to https
}

server {

add_header 'X-GG-Cache-Status' $upstream_cache_status;
add_header 'Access-Control-Allow-Origin' 'http://google.com';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET';

# SSL configuration
#
listen 443 ssl;

ssl_certificate /etc/nginx/ssl/watchbox.ge/certificate.crt;
ssl_certificate_key /etc/nginx/ssl/watchbox.ge/private.key;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL;



#IMPROVE PERFOMANCE OF PAGE WITH GZIP + CACHING

gzip on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;

gzip_types
application/atom+xml
application/javascript
application/json
application/ld+json
application/manifest+json
application/rss+xml
application/vnd.geo+json
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/bmp
image/svg+xml
image/x-icon
text/cache-manifest
text/css
text/plain
text/vcard
text/vnd.rim.location.xloc
text/vtt
text/x-component
text/x-cross-domain-policy;
# text/html is always compressed by gzip module

location ~* \.(jpg|jpeg|png|gif|ico|css|js|pdf)$ {
expires 7d;
}

#END IMPROVE PERFOMANCE OF PAGE WITH GZIP + CACHING


root /var/www/watchbox.ge/public_html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;

server_name www.watchbox.ge watchbox.ge;
keepalive_timeout 70;
location / {

add_header Access-Control-Allow-Origin "*";

proxy_pass https://watchbox.ge;

proxy_set_header Host $host;
proxy_buffering on;
proxy_cache watchbox_cache;
proxy_ignore_headers Cache-Control;
proxy_cache_valid 200 1d;
proxy_ignore_headers "Set-Cookie";
proxy_hide_header "Set-Cookie";
proxy_cache_valid 200 1d;
proxy_cache_min_uses 3;
proxy_cache_bypass $cookie_nocache $arg_nocache$arg_comment;
proxy_cache_revalidate on;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_background_update on;
proxy_cache_lock on;

try_files $uri $uri/ /index.php$is_args$args;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
#try_files $uri =404;
include snippets/fastcgi-php.conf;
#
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
# TIMEOUT
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
#fastcgi_read_timeout 300;
}




}
Subject Author Posted

Caching Method

hhypnos August 14, 2019 03:34PM

RE: Caching Method

Reinis Rozitis August 14, 2019 05:32PM

Re: RE: Caching Method

hhypnos August 15, 2019 07:36PM

Re: RE: Caching Method

hhypnos August 15, 2019 07:38PM

Re: RE: Caching Method

Francis Daly August 16, 2019 03:44AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 203
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready