【发布时间】:2015-10-15 19:17:34
【问题描述】:
我在 Nginx(不是虚拟机)上运行 Laravel 站点(Ubuntu)。当我对 css 文件或与此相关的任何文件进行更改时,我无法立即看到更改。我已尝试将 sendfile 从打开更改为关闭,如此链接中所述:
How to clear the cache of nginx?
而且我找不到 Nginx 缓存文件来删除缓存。许多网站建议转到“path/to/cache”文件夹,但我找不到:
https://www.nginx.com/blog/nginx-caching-guide/
无论如何,我不相信我设置了任何类型的代理缓存或任何东西。有什么想法可以找到我的缓存以便我可以删除它吗?就此而言,我是否希望在这里做正确的事情?感谢您提前回答。
这是我的测试服务器块的样子:
server {
# secure website with username and password in htpasswd file
auth_basic "closed website";
auth_basic_user_file /tmp/.htpasswd.txt;
listen (myip) default_server;
listen [::]:83 default_server ipv6only=on;
root /var/www/test/(sitefolder);
index index.php index.html index.htm;
# Make site accessible
server_name (myiphere);
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
这是我的真实站点服务器块的样子:
server {
# secure website with username and password in htpasswd file
auth_basic "closed website";
auth_basic_user_file /tmp/.htpasswd.txt;
listen (myip) default_server;
listen [::]:81 default_server ipv6only=on;
root /var/www/(mysite)/public;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name (myip);
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
【问题讨论】:
-
您是否尝试过清除浏览器的缓存? Css 通常由客户端缓存,而不是服务器。
标签: php css nginx server digital-ocean