संपत्तियों को चलाने पर: प्रीकंपाइल रेक कार्य, आपके ऐप की संपत्ति के gzipped संस्करण बनाए जाते हैं। संपत्ति पाइपलाइन के लिए रेल गाइड के मुताबिक, वेब सर्वर करने के बजाए इन प्रीकंप्रेस्ड फाइलों की सेवा के लिए आप अपने वेब सर्वर (मेरे मामले अपाचे 2.2 में) को कॉन्फ़िगर कर सकते हैं।संपत्तियों के साथ तैयार gzipped संपत्तियों को सेवा देने के लिए mod_deflate को कॉन्फ़िगर कैसे करें: precompile
मुझे क्या पता नहीं लगा सकता है कि mod_deflate कॉन्फ़िगर कैसे किया जाए ताकि इन फ़ाइलों को डबल-संपीड़ित होने के बजाय परोसा जाता है और फिर सेवा दी जाती है? सार्वजनिक/परिसंपत्तियों में .htaccess में जाने के लिए मार्गदर्शिका
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
और मैं रेल पर कोड परिवर्तित कर दिया है:
मैं mod_deflate httpd.conf के माध्यम से सक्षम किया गया है
# Some browsers still send conditional-GET requests if there's a
# Last-Modified header or an ETag header even if they haven't
# reached the expiry date sent in the Expires header.
Header unset Last-Modified
Header unset ETag
FileETag None
# RFC says only cache for 1 year
ExpiresActive On
ExpiresDefault "access plus 1 year"
# Serve gzipped versions instead of requiring Apache to do the work
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}.gz -s
RewriteRule ^(.+) $1.gz [L]
# without it, Content-Type will be "application/x-gzip"
<FilesMatch .*\.css.gz>
ForceType text/css
</FilesMatch>
<FilesMatch .*\.js.gz>
ForceType text/javascript
</FilesMatch>
कोई विचारों को ठीक से कैसे सेट करें?
छोटे टिप्पणी - अगर यह .htaccess में नहीं है, यह निर्देशिका खंड में हो सकता है, जरूरत है अन्यथा -s काम नहीं करेगा। – lzap
इसके अलावा, आपको शायद 'टेक्स्ट/जावास्क्रिप्ट' के बजाय 'एप्लिकेशन/जावास्क्रिप्ट' के उपयोग की अनुशंसा करनी चाहिए। * स्क्रिप्टिंग मीडिया प्रकार * पर [RFC4329] (https://tools.ietf.org/html/rfc4329) देखें। – tne
मुझे \t AddEncoding gzip .gz अन्यथा अच्छा –
Torsten