我无法找到解决此问题的方法,我已经在这里阅读了所有相关主题。我理解这是某些目录中的Require指令存在的一些问题。但我没有任何"要求所有人拒绝"除了/,/ var / www有"要求所有被授予"。我怀疑这与文件在磁盘上确实存在的事实有关,但我不知道如何修复它。
只有在mod_pagespeed(版本1.11.33.2-r0)中激活rewrite_images或compress_images过滤器时才会发生这种情况。
img标签发生错误,例如:
<img src="/img/cms/img.png" alt="img" width="330" height="145" style="max-width: 100%; height: auto; -webkit-box-shadow: 0 10px 6px -6px rgba(0,0,0,0.8); -moz-box-shadow: 0 10px 6px -6px rgba(0,0,0,0.8); box-shadow: 0 10px 6px -6px rgba(0,0,0,0.8);">
转换为:
<img src="/img/cms/ximg.png.pagespeed.ic.7r3fOhvSE_.webp" alt="img" width="330" height="145" style="max-width: 100%; height: auto; -webkit-box-shadow: 0 10px 6px -6px rgba(0,0,0,0.8); -moz-box-shadow: 0 10px 6px -6px rgba(0,0,0,0.8); box-shadow: 0 10px 6px -6px rgba(0,0,0,0.8);" data-pagespeed-url-hash="885240078" onload="pagespeed.CriticalImages.checkImageForCriticality(this);">
并在apache日志中抛出此错误:
[Tue Jul 26 15:03:00.609926 2016] [access_compat:error] [pid 8116:tid 140318443788032] [client x.x.x.x:46972] AH01797: client denied by server configuration: uri /img/cms/ximg.png.pagespeed.ic.7r3fOhvSE_.webp, referer: https://www.example.com/
在浏览器控制台中显示403。
我还尝试启用调试,不再显示。
apache2.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /var/www/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
vhost.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin info@example.com
ServerName www.example.com
ServerAlias example.com
DocumentRoot /var/www/example/
LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/ssl.error.log
CustomLog ${APACHE_LOG_DIR}/ssl.access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/mycert.crt
SSLCertificateKeyFile /etc/ssl/private/mycert.key
SSLCACertificateFile /etc/ssl/certs/mycert.cer
<IfModule setenvif_module>
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
</IfModule>
<FilesMatch ".+\.ph(p[3457]?|t|tml)$">
SetHandler "proxy:unix:/run/php/mysite-fpm.sock|fcgi://localhost"
</FilesMatch>
<FilesMatch ".+\.phps$">
Require all denied
</FilesMatch>
<FilesMatch "^\.ph(p[3457]?|t|tml|ps)$">
Require all denied
</FilesMatch>
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>
我做错了什么?