जबकि मैं कई नए लेख हाल ही में नहीं लिखा है मैं काफी समय व्यतीत किया है अद्यतन करने और चीजों की परदे के पीछे के पक्ष में संशोधन, अर्थात् विभिन्न सुरक्षा (टीएलएस) पर सेटिंग्स मेरी वीपीएस कि यह एक सहित कई साइटों होस्ट करता है। एक और बात मैं भी हाल ही में बढ़ाने के लिए काम किया है gzip के अपने उपयोग में सुधार है, और एक नया प्रारूप brotli बुलाया
संक्षिप्त, gzip (और brotli) can be used to compress resources before they are sent to the browser, जो भेजे गए डेटा की मात्रा को कम, and hence should mean a site loads faster. The downside is that compressing resources takes time, which could outweigh the gains from the smaller sizes. The ideal solution is to have resources compressed in advance, rather than compressed by the http server in realtime. Most of my websites use wordpress which contains lots of files in plugins, विषयों आदि, so going through all of these and manually compressing them everytime there is an update would be impractical. The answer is to use a script which monitors the system for file changes, and creates compressed files as needed. Below is the script I have recently written to do exactly this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | #!/bin/bash inotifywait -m -q -e CREATE -e MODIFY -e MOVED_TO -r “/var/www/” –format “%w%f” –excludei ‘\.(jpg|png|gif|ico|log|sql|zip|gz|pdf|php|swf|ttf|eot|woff|cst|jst|br|cts)$’ | while read file do if [[ $file =~ \.(css)$ ]]; then fname=”${file%.*}” if [ -f “$fname”.min.css ] then rm -f $file.gz rm -f $file.br zopfli –gzip $file bro –quality 11 –input $file –output $file.br chmod 664 $file.br chmod 664 $file.gz chown wordpress:wordpress $file.br chown wordpress:wordpress $file.gz else rm -f $file.gz rm -f $file.br cat $file | cleancss > $fname.cst cat $file | cleancss | bro –quality 11 –output $file.br zopfli –gzip $fname.cst -c > $fname.css.gz chmod 664 $file.br chmod 664 $file.gz chown wordpress:wordpress $file.br chown wordpress:wordpress $file.gz rm -f $fname.cst fi fi if [[ $file =~ \.(js)$ ]]; then fname=”${file%.*}” if [ -f “$fname”.min.css ] then rm -f $file.gz rm -f $file.br zopfli –gzip $file bro –quality 11 –input $file –output $file.br chmod 664 $file.br chmod 664 $file.gz chown wordpress:wordpress $file.br chown wordpress:wordpress $file.gz else rm -f $file.gz rm -f $file.br uglifyjs $fname.js > $fname.jst zopfli –gzip $fname.jst -c > $fname.js.gz bro –quality 11 –input $fname.jst –output $file.br chmod 664 $file.br chmod 664 $file.gz chown wordpress:wordpress $file.br chown wordpress:wordpress $file.gz rm -f $fname.jst fi fi origfs=$(wc -c < “$file”) gzfs=$(wc -c <”$file.gz”) brfs=$(wc -c <”$file.br”) if [ “$origfs” -lt “$gzfs” ]; then rm $file.gz -f fi if [ “$origfs” -lt “$brfs” ]; then rm $file.br -f fi done |
इस उपयोगी पाया? कृपया हमें सूचित करते नीचे एक टिप्पणी छोड़ने के द्वारा. आप सदस्यता के लिए चाहते हैं, तो ऊपर दाईं ओर मेनू पर लिंक का उपयोग करें सदस्यता लें. आप नीचे दिए गए सामाजिक लिंक का उपयोग करके अपने दोस्तों के साथ इस साझा कर सकते हैं. चियर्स.
उत्तर छोड़ दें