Mientras que no he escrito muchos artículos nuevos recientemente he pasado un tiempo considerable actualización y revisión de la parte de detrás de las escenas de las cosas, es decir, varios de seguridad (TLS) configuración de mi VPS que aloja varios sitios incluyendo éste. Otra cosa también he trabajado para mejorar recientemente es mejorar mi uso de gzip, y un nuevo formato llamado Brotli
Brevemente, gzip (y Brotli) can be used to compress resources before they are sent to the browser, lo que reduce la cantidad de datos enviados, 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, temas, etc., 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.
#!/bin/bash inotifywait -m -q -e CREATE -e MODIFY -e MOVED_TO -r "/var / www /" --formato "%w% f" -- Excludei'.(jpg|png|gif|ico|Iniciar sesión|sql|cremallera|gz|pdf|php|SWF|ttf|EOT|woff|cst|JST|br|cts)$' | while read file do if [[ $file = ~ \.(css)$ ]]; then fname="${archivo%.*}" si [ -F "$fnombre".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="${archivo%.*}" si [ -F "$fnombre".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 < "$expediente") gzfs = $(wc -c <"$file.gz") BRFS = $(wc -c <"$file.br") si [ "$origfs" -lt "$gzfs" ]; then rm $file.gz -f fi if [ "$origfs" -lt "$BRFS" ]; then rm $file.br -f fi done
“Hi James I realise it has been a long while, but I just checked this on windows 11 (build 23H2)…”