Nginx
3
Вклад в тег
apt-get install iptables-persistent
ipset save > /etc/ipset.rules
ipset restore < /etc/ipset.rules
service iptables-persistent save
python manage.py dumpdata --indent=2 --exclude auth.permission --exclude contenttypes -o db.json
gzip on;
gzip_comp_level 4;
gzip_static on;
#! /bin/sh
EXTENSIONS="txt|htm|html|xml|yml|htc|ico"
if [ -z "$1" ]; then
DIR="`pwd`"
else
DIR="$1"
fi
find $DIR -type f -regextype posix-egrep -regex ".*\.($EXTENSIONS)\$" -exec `dirname $0`/do-compress.sh '{}' \;
#! /bin/sh
MINSIZE=100
GZIP="gzip -9 -c"
AWK=awk
TOUCH=touch
CHOWN=chown
CHMOD=chmod
if [ -n "$1" ]; then
GZ_NAME="$1.gz"
DATA_PLAIN=`stat --format "%s %Y" "$1"`
PLAIN_SIZE=`echo "$DATA_PLAIN" | $AWK '{ print $1}'`
PLAIN_MTIME=`echo "$DATA_PLAIN" | $AWK '{ print $2}'`
if [ $PLAIN_SIZE -lt $MINSIZE ]; then
echo "$1 - Ignoring file: its size ($PLAIN_SIZE) is less than $MINSIZE bytes"
exit 0;
fi
if [ -f "$GZ_NAME" ]; then
GZIPPED_MTIME=`stat --format "%Y" "$GZ_NAME"`
if [ $GZIPPED_MTIME -eq $PLAIN_MTIME ]; then
echo "$1 - Ignoring file: already exist with the same mod time"
exit 0
fi
fi
$GZIP "$1" > "$GZ_NAME"
$TOUCH -r "$1" "$GZ_NAME"
$CHOWN --reference="$1" "$GZ_NAME"
$CHMOD 640 "$GZ_NAME"
echo "Compressed $1 to $GZ_NAME"
fi
#! /bin/sh
EXTENSIONS="css|js"
if [ -z "$1" ]; then
DIR="`pwd`"
else
DIR="$1"
fi
find $DIR -type f -regextype posix-egrep -regex ".*\.($EXTENSIONS)\$" -exec `dirname $0`/do-compress-js-css.sh '{}' \;
#! /bin/sh
MINSIZE=100
JV="java -jar /usr/share/yui-compressor/yui-compressor.jar"
GZIP="gzip -9 -c"
AWK=awk
TOUCH=touch
CHOWN=chown
CHMOD=chmod
if [ -n "$1" ]; then
GZ_NAME="$1.gz"
DATA_PLAIN=`stat --format "%s %Y" "$1"`
PLAIN_SIZE=`echo "$DATA_PLAIN" | $AWK '{ print $1}'`
PLAIN_MTIME=`echo "$DATA_PLAIN" | $AWK '{ print $2}'`
if [ $PLAIN_SIZE -lt $MINSIZE ]; then
echo "Ignoring file $1: its size ($PLAIN_SIZE) is less than $MINSIZE bytes"
exit 0;
fi
if [ -f "$GZ_NAME" ]; then
GZIPPED_MTIME=`stat --format "%Y" "$GZ_NAME"`
if [ $GZIPPED_MTIME -eq $PLAIN_MTIME ]; then
echo "$1 - Ignoring file: already exist with the same mod time"
exit 0
fi
fi
$JV "$1" | $GZIP > "$GZ_NAME"
$TOUCH -r "$1" "$GZ_NAME"
$CHOWN --reference="$1" "$GZ_NAME"
$CHMOD 640 "$GZ_NAME"
echo "Compressed $1 to $GZ_NAME"
fi
apt-get install yui-compressor
53 4 * * * root nice -n 19 ionice -c2 -n7 /root/scripts/gzip-compress/compress-js-css.sh /var/www/папка_которую/обработать
nice -n 19
ionice -c2 -n7
53 4 * * * root /root/scripts/gzip-compress/compress-js-css.sh /var/www/папка_которую/обработать