如何告诉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
最满意答案
检查一个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
afterwhere
clause. If you are looking at the SQL generated form that named query you will see that joined tables in the query thewhere
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 ...
-
JPA NamedQuery获取引用的对象而不执行连接(JPA NamedQuery to obtain a referenced object without executing join)[2023-03-10]
您的查询是正确的,只有您需要获得不同的客户,因为同一产品客户可能不止一次订购 query = "SELECT distinct(o.customer)" "FROM Order o "+ "WHERE o.productId = :productId" 获得客户: Query qry = em.createNamedQuery("GetCustomersByProduct"); ListresultList = 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 ...