0
試圖讓nginx緩存靜態資產,但在所有內容上都得到404。如果我拿出緩存塊,它工作正常,但顯然它不是緩存。我怎樣才能設置它,以便通過nginx緩存?在nginx中緩存&ssl
server {
listen 80;
return 301 https://$host$request_uri;
}
upstream backends {
server 127.0.0.1:8443;
#server 192.168.100.101:80;
}
server {
listen 443 ssl; # 'ssl' parameter tells NGINX to decrypt the traffic
server_name example.com;
ssl_certificate /etc/nginx/ssl/nginx.crt; # The certificate file
ssl_certificate_key /etc/nginx/ssl/nginx.key; # The private key file
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
location/{
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://backends;
}
location ~* \.(css|js|gif|jpe?g|png)$ {
expires 168h;
}
}