首页 \ 问答 \ 如何告诉gzip_static不要查找图像文件?(How to tell gzip_static not to look for image files?)

如何告诉gzip_static不要查找图像文件?(How to tell gzip_static not to look for image files?)

我安装了nginx并激活了gzip_static。 它适用于CSS和JavaScript文件,但它也会查找gzip压缩版本的图像文件,如.png和.gif,尽管这些文件不在要压缩的文件列表中:

# strace -p 25044 2>&1 | grep gz
open("/var/www/css/ymax.css.gz", O_RDONLY|O_NONBLOCK) = 438
open("/var/www/images/tools.png.gz", O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
open("/var/www/images/ads/bs.gif.gz", O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
open("/var/www/images/gfxborder/border_right.gif.gz", O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
open("/var/www/images/ads/hocuto03.gif.gz", O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)

这是我的nginx配置:

gzip  on;
gzip_disable     "msie6";
gzip_min_length 1000;
gzip_types text/plain text/css application/x-javascript text/javascript;
gzip_static on;

有办法防止这种情况吗?


I have nginx installed with gzip_static activated. It works fine for CSS and JavaScript files, but it also looks for gzipped versions of image files like .png and .gif, although these are not in the list of files to be compressed:

# strace -p 25044 2>&1 | grep gz
open("/var/www/css/ymax.css.gz", O_RDONLY|O_NONBLOCK) = 438
open("/var/www/images/tools.png.gz", O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
open("/var/www/images/ads/bs.gif.gz", O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
open("/var/www/images/gfxborder/border_right.gif.gz", O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
open("/var/www/images/ads/hocuto03.gif.gz", O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)

Here's my nginx configuration:

gzip  on;
gzip_disable     "msie6";
gzip_min_length 1000;
gzip_types text/plain text/css application/x-javascript text/javascript;
gzip_static on;

Is there a way to prevent this?


原文:https://stackoverflow.com/questions/3972675
更新时间:2023-07-17 20:07

最满意答案

检查一个SQL语法,你不能在where子句之后使用left join 。 如果您正在查看命名查询的SQL生成表单,您将看到查询中的连接表在连接之后出现where子句,并且应指定通过键链接这些表的相等条件。 左侧主表的主键和右侧连接表的外键。 连接表由多对一关联的属性指定。

@NamedQuery(
    name = "findOneWithLists",
    query = "from Table t left join User u where u.id= :id"
)

Check a SQL syntax, you can't use left join after where clause. If you are looking at the SQL generated form that named query you will see that joined tables in the query the where clause comes after joins and should specify equal condition that links those tables by the keys. The primary key of the main table on the left and the foreign key of the joined table on the right. The joined table is specified by the property of your many-to-one association.

@NamedQuery(
    name = "findOneWithLists",
    query = "from Table t left join User u where u.id= :id"
)

相关问答

更多
  • 命名查询不是动态的,但您可以尝试此解决方案: @NamedQuery(name = Employment.EMPLOYEES, query = Employment.NAMED_QUERY) @Entity public class Employment{ private static String NAMED_QUERY= "default query"; //+your persistent fields/properties... } public String buildQuery ...
  • 也许是这样的? @NamedQuery(name = "AccountDef.getAvaibleInterestAccountsForBranch", query = "SELECT ad FROM AccountDef ad LEFT JOIN FETCH ad.branchParamsInterest bp WHERE bp.interestAccount = NULL ORDER BY ad.id ASC") Perhaps something like this? @Name ...
  • 下面是示例查询,它只获取必需的字段,但必须为它创建这样的构造函数。 查询: SELECT NEW package_name.Employee(e.username,e.email,e.image,e.firstname,e.lastname) FROM Employee e where e.empid=?1; 它将返回具有所选字段的Employee实体,其余将具有默认值。 Below is the sample query which fetches only the required fields, bu ...
  • 您的查询是正确的,只有您需要获得不同的客户,因为同一产品客户可能不止一次订购 query = "SELECT distinct(o.customer)" "FROM Order o "+ "WHERE o.productId = :productId" 获得客户: Query qry = em.createNamedQuery("GetCustomersByProduct"); List resultList = qry.getResultList() ...
  • JPA的规格说: 本规范的实现不需要支持多级提取连接。 使用多级提取联接的应用程序将不可移植。 尝试减少查询中的提取连接并稍后初始化数据(数据选择后)。 您可以在同一事务中使用size()或Hibernate.initialize()初始化延迟加载的数据,例如: publication.getFounders().size(); 要么 Hibernate.initialize(publication.getFounders()); Specification of JPA says: Multiple ...
  • 默认情况下,至少使用Hibernate,默认的提取类型是Lazy ,因此您需要进行join fetch而不是join 。 此外,您应该select distinct 。 尝试: SELECT distinct a FROM AName a LEFT JOIN fetch a.aNameRoleList r WHERE r.inactiveflag='N' and r.aNameRolePK.nametype='5' 参考: Hibernate中一对一,多对一和一对多的默认提取类型 After more t ...
  • 检查一个SQL语法,你不能在where子句之后使用left join 。 如果您正在查看命名查询的SQL生成表单,您将看到查询中的连接表在连接之后出现where子句,并且应指定通过键链接这些表的相等条件。 左侧主表的主键和右侧连接表的外键。 连接表由多对一关联的属性指定。 @NamedQuery( name = "findOneWithLists", query = "from Table t left join User u where u.id= :id" ) Check a SQL ...
  • 好的,最后我写了正确的查询,我写了评论, SELECT DISTINCT s, COUNT(i) FROM ModTopScope s LEFT JOIN s.modInstallResults i " + "WHERE s.modScopeType.modSystem.activated = true " + "GROUP BY s " + "ORDER BY COUNT(i) DESC OK, finally i wrote the correct querym i wrote comment, SEL ...
  • 我已经解决了这个问题。 我在persistence.xml中添加了以下类标记来解决问题, com.wachovia.apps.amaster.orm.Officer 标记的顺序在persistence.xml中很重要。 在我的例子中,必须在标记之前和标记之后添加此类标记。 I have resolved the issue. I have added the the following class tag in per ...
  • 除非您映射实体之间的关联,否则您似乎无法执行左连接 。 就我而言,即使位置存在,OrganizationExt也不会映射到Header。 所以我似乎可以创建一个包含这些信息的Oracle视图,并直接创建一个Hibernate映射。 It seems you cannot execute a left join unless you map an association between the entities. In my case, OrganizationExt is not mapped into H ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)