我正在尝试使用nginx fastcgi
网站实施laravel
缓存,但我得到一个空白页。
我已经检查了laravel
和nginx
的日志,它们没有显示任何错误甚至是访问日志,但是缓存确实存储在目录中#39;应该是。
我已尝试在同一服务器上安装wordpress
的相同缓存指令,这些指令完美无缺。我只是想知道是否需要为nginx
使用特定的laravel
缓存指令,以及是否有人可以为laravel
建议更好的缓存替代方案。
这是我的服务器conf:
fastcgi_cache_path /tmp/cache levels=1:2 keys_zone=MYAPP:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
server {
listen 80;
listen [::]:80;
server_name site.com www.site.com;
root /var/www/site/public;
index index.php index.html index.htm index.nginx-debian.html;
set $no_cache 0;
charset utf-8;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/myapp-error.log error;
sendfile off;
client_max_body_size 100m;
location ~ \.php$ {
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 60m;
fastcgi_cache_methods GET HEAD;
add_header X-Fastcgi-Cache $upstream_cache_status;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
location ~ /\.ht {
deny all;
}
}