我遇到一个困难,无法使用awstats工具(CGI脚本),图标和相关的直方图条显示在我的一个网站上(此处标记为website.com
。]
由于我使用不同的RewriteCond和RewriteRules来将http://www.website.com, http://website.com, https://www.website.com
重定向到https://website.com
目标,所以这个问题非常棘手。
此外,由于我在Apache之后有一个Zope服务器,因此任务更加复杂。
因此,总而言之,这里所有产生预期结果的所有rewritecond和rewriterules,即所有重定向到https://website.com
和通过密码访问awstats
工具的东西。一切正常,除了在awstats
的主页面加载后,图标和直方图丢失之后:
<VirtualHost *:443>
# Test local
ServerAdmin [email protected]
ServerName website.com
ServerAlias www.website.com
# LOG
CustomLog /var/log/apache2/access.log combined
# ACTIVATE SSL
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/website.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/website.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/website.com/chain.pem
RewriteEngine On
# www to non www for HTTPS
# checking for the same thing again
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
# some people might argue second redirect here is excessive since you already arrived at correct host, but I'd leave this for you to sort out
RewriteRule ^/(.*) https://website.com/$1 [R=301,L]
# your /cgi-bin checks can be merged into one regex
RewriteCond %{REQUEST_URI} !^/cgi-bin/(search|awstats) [NC]
RewriteRule ^/(.*) https://localhost:8443/++vh++https:%{SERVER_NAME}:443/++/$1 [P,L]
SSLProxyEngine On
RequestHeader set Front-End-Https "On"
#CacheDisable *
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
Alias /awstatsclasses "/usr/share/awstats/lib/"
Alias /awstats-icon "/usr/share/awstats/icon/"
Alias /awstatscss "/usr/share/doc/awstats/examples/css"
<Files "awstats.pl">
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
SetHandler cgi-script
Satisfy any
Order deny,allow
Deny from all
AuthType Basic
AuthName "Advanced Web Statistics"
AuthUserFile /etc/apache2/awstats-users.pwd
Require valid-user
</Files>
<Directory "/usr/share/awstats/icon">
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/usr/lib/cgi-bin/">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
SSLRequireSSL
</Directory>
</VirtualHost>
我不是CGI脚本及其别名的专家。所有图标都位于/usr/share/awstats/icon/
目录中。
我的错误在哪里?
我认为您忘记了quotes
,如果这不能解决您的问题,请检查apache error log
Alias "/awstatsclasses" "/usr/share/awstats/lib/"
Alias "/awstats-icon" "/usr/share/awstats/icon/"
Alias "/awstatscss" "/usr/share/doc/awstats/examples/css"