[英]Setting up GitLab 8.16.0 on a vServer running Ubuntu 14.04 with Plesk and Apache2
[英]Setting up caching in Apache2 on ubuntu 14.04
我正在尝试在服务器上设置缓存,这是我的htaccess。 该代码来自不同的网站(缓存代码)。 我真的找不到最新版本的apache mod_expires.c是否仍然使用,并且我还使用了sudo a2enmod expires命令,该命令有效,然后我重新启动了Web服务器。 我正在使用页面洞察力来检查杠杆/缓存是否有效,但似乎不起作用,甚至重新加载网站时,我都可以看到图像已下载且没有立即加载。
ErrorDocument 404 /
ErrorDocument 403 /
Options ALL -Indexes
RewriteEngine On
RewriteEngine On
RewriteRule ^([0-9]+\.[^a-zA-Z]+)$ index.php?Patch_No=$1 [NC,L]
RewriteRule ^([0-9]+\.[^a-zA-Z]+)&([0-9a-zA-Z_-]+)$ index.php?Patch_No=$1&tab=$2 [NC,L]
RewriteRule ^patches php/patches.php [NC,L]
RewriteRule ^([^0-9][\s'0-9a-zA-Z_-]+[^0-9])$ index.php?Champion=$1 [NC,L]
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType text/css "access 1 month"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##
sudo a2enmod file_cache
sudo service apache2 restart
打开
sudo nano /etc/apache2/apache2.conf
在.htaccess下添加以下行
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
然后
sudo service apache2 restart
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.